Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added next year to yearly report page #443

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions stregreport/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@

FORMAT = '%d/%m/%Y kl. %H:%M'
last_year = year - 1
next_year = year + 1

Check warning on line 347 in stregreport/views.py

View check run for this annotation

Codecov / codecov/patch

stregreport/views.py#L347

Added line #L347 was not covered by tests
from_time = fjule_party(year - 1)
to_time = fjule_party(year)
kr_stat_list = sale_money_rank(from_time, to_time)
Expand All @@ -355,6 +356,7 @@
from_time_string = from_time.strftime(FORMAT)
to_time_string = to_time.strftime(FORMAT)
current_date = timezone.now()
show_next_year = year < current_date.year

Check warning on line 359 in stregreport/views.py

View check run for this annotation

Codecov / codecov/patch

stregreport/views.py#L359

Added line #L359 was not covered by tests
is_ongoing = current_date > from_time and current_date <= to_time
return render(request, 'admin/stregsystem/report/ranks.html', locals())

Expand Down
1 change: 1 addition & 0 deletions stregsystem/templates/admin/stregsystem/report/ranks.html
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,6 @@ <h1>Rangeringer for {{year}}</h1>
</div>
<div style="clear: both;">&nbsp;</div>
<a href="./{{last_year}}">Forrige år</a>
{% if show_next_year %}<a style="float: right;" href="./{{next_year}}">Næste år</a> {% endif %}
MartinPTielemans marked this conversation as resolved.
Show resolved Hide resolved

{% endblock %}
Loading