Skip to content

Commit

Permalink
Merge pull request #220 from Seshat-Global-History-Databank/bug-208
Browse files Browse the repository at this point in the history
Add version parameter to JS file includes to ensure latest version is used
  • Loading branch information
edwardchalstrey1 authored Jan 9, 2025
2 parents 029d5aa + f63ce69 commit cf5be5d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion seshat/apps/core/templates/core/polity_map.html
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ <h2 class="h2 text-dark federicka-medium">
style="width: 100%;" list="yearTickmarks">
<div id="yearTickmarkValues"></div><br>
</div>
<script src="{% static 'core/js/map_functions.js' %}"></script>
<script src="{% static 'core/js/map_functions.js' %}?v={{ version }}"></script>
<script>

// Hide components/polity switch for now so "Polity components" is always displayed
Expand Down
2 changes: 1 addition & 1 deletion seshat/apps/core/templates/core/world_map.html
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ <h2>How to use the Seshat World Map</h2>
</div>
</div>
</div>
<script src="{% static 'core/js/map_functions.js' %}"></script>
<script src="{% static 'core/js/map_functions.js' %}?v={{ version }}"></script>
<script>

// Hide components/polity switch for now so "Full polities" is always displayed
Expand Down
9 changes: 9 additions & 0 deletions seshat/apps/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4578,6 +4578,9 @@ def map_view_initial(request):
# Set the last year in history we ever want to display, which will be used to determine when we should say "present"
content['last_history_year'] = content['latest_year'] # Set this to the latest year in the data or a value of choice

# Add version parameter to force browser to fetch the latest JS file
content['version'] = int(time.time())

return render(request,
'core/world_map.html',
content
Expand Down Expand Up @@ -4611,6 +4614,9 @@ def map_view_all(request):
# Set the last year in history we ever want to display, which will be used to determine when we should say "present"
content['last_history_year'] = content['latest_year'] # Set this to the latest year in the data or a value of choice

# Add version parameter to force browser to fetch the latest JS file
content['version'] = int(time.time())

return JsonResponse(content)

def map_view_all_with_vars(request):
Expand Down Expand Up @@ -4653,6 +4659,9 @@ def map_view_all_with_vars(request):
content['highest_complexity_values']['military_level'] = max([max(filter(None, shape['military_level']), default=0) for shape in content['shapes'] if shape['military_level']], default=0)
content['highest_complexity_values']['administrative_level'] = max([max(filter(None, shape['administrative_level']), default=0) for shape in content['shapes'] if shape['administrative_level']], default=0)

# Add version parameter to force browser to fetch the latest JS file
content['version'] = int(time.time())

return JsonResponse(content)

def provinces_and_countries_view(request):
Expand Down

0 comments on commit cf5be5d

Please sign in to comment.