Skip to content
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.

Commit

Permalink
Bug fixes (#33)
Browse files Browse the repository at this point in the history
* Remove now unused selectize library

* Don't force progression time unit

* Only show progression if there's more than 1 point to show

* Change log for version 2020.05.15
  • Loading branch information
rubenvanerk authored May 15, 2020
1 parent 959510c commit 9c9123b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
5 changes: 0 additions & 5 deletions lifesaving_rankings/templates/lifesaving_rankings/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@
<link rel="stylesheet" type="text/css"
href="https://cdn.datatables.net/1.10.16/css/dataTables.semanticui.min.css"/>

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.12.4/css/selectize.min.css"
integrity="sha256-4BosA+P6Qycvyi2wsMf6zbq9Em7BJqMXk/SpXbQVJJY=" crossorigin="anonymous"/>
<!-- This file stores project-specific CSS -->
<link href="{% static 'dist/css/main.css' %}" rel="stylesheet">

Expand Down Expand Up @@ -258,9 +256,6 @@ <h1><span class="de-emphasis">Lifesaving</span> Rankings</h1>
<script type="text/javascript"
src="https://cdn.datatables.net/1.10.16/js/dataTables.semanticui.min.js "></script>

<script src="https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.12.4/js/standalone/selectize.js"
integrity="sha256-YhmtrYJDSZgZFL8jDCR8VNOV/iigJPZYNCk8L9J72Hk=" crossorigin="anonymous"></script>

<!-- place project specific Javascript in this file -->
<script src="{% static 'dist/js/main.js' %}"></script>

Expand Down
10 changes: 10 additions & 0 deletions lifesaving_rankings/templates/lifesaving_rankings/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@

{% block content %}
<h1>Changelog</h1>
<h2 id="2020.05.15">2020.05.15</h2>
<h3>Changed</h3>
<ul>
<li>Made scale on progression graph dynamic so it's easier readable</li>
<li>Improved performance for creating and updating analysis groups</li>
</ul>
<h3>Fixed</h3>
<ul>
<li>Hide progression graph when there's only 1 point available</li>
</ul>
<h2 id="2020.05.08">2020.05.08</h2>
<h3>Fixed</h3>
<ul>
Expand Down
5 changes: 2 additions & 3 deletions lifesaving_rankings/templates/rankings/event_by_athlete.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
{% endblock %}

{% block javascript_after %}
{% if object_list|length > 1 %}
{% if results_ordered_by_date|length > 1 %}
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.8.0/Chart.bundle.min.js"
integrity="sha256-xKeoJ50pzbUGkpQxDYHD7o7hxe0LaOGeguUidbq6vis="
crossorigin="anonymous"></script>
Expand Down Expand Up @@ -80,7 +80,6 @@
xAxes: [{
type: 'time',
time: {
unit: 'month',
tooltipFormat: 'MMMM D, Y'
}
}]
Expand All @@ -103,7 +102,7 @@ <h1>
</button>
</a>

{% if object_list|length > 1 %}
{% if results_ordered_by_date|length > 1 %}
<button class="ui left labeled icon primary button" onclick="$('.ui.modal.chart').modal('show');">
<i class="chart area icon"></i>
Progression
Expand Down
3 changes: 3 additions & 0 deletions rankings/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ def get_context_data(self, *, object_list=None, **kwargs):
context['athlete'] = athlete = self.get_athlete()
context['event'] = event = self.get_event()
results_ordered_by_date = self.get_queryset().order_by('competition__date')

# if 2 results on 1 day, only show fastest
previous_result = None
for i, result in enumerate(results_ordered_by_date):
if previous_result is not None and result.competition.date == previous_result.competition.date:
Expand All @@ -277,6 +279,7 @@ def get_context_data(self, *, object_list=None, **kwargs):
else:
results_ordered_by_date = results_ordered_by_date.exclude(pk=result.pk)
previous_result = result

context['results_ordered_by_date'] = results_ordered_by_date
context['fastest_time'] = IndividualResult.objects.filter(athlete=athlete, event=event, did_not_start=False,
disqualified=False).aggregate(Min('time'))
Expand Down

0 comments on commit 9c9123b

Please sign in to comment.