Skip to content
This repository has been archived by the owner on Oct 28, 2020. It is now read-only.

Commit

Permalink
[bug 975537] Do not display both start and end dates if they match.
Browse files Browse the repository at this point in the history
  • Loading branch information
akatsoulas committed Mar 12, 2014
1 parent 987c0b0 commit f754cb9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions remo/base/templates/dashboard_reps.html
Expand Up @@ -46,7 +46,7 @@ <h2>Reports</h2>
<span class="date-range">
{{ date_to_weeks(user.userprofile.current_streak_start,
today.date()) }} weeks<br>
{% if user.userprofile.current_streak_start|is_date_today %}
{% if is_same_day(user.userprofile.current_streak_start) %}
Today
{% else %}
{{ user.userprofile.current_streak_start|strftime('%d %b %Y')}}
Expand All @@ -64,8 +64,11 @@ <h2>Reports</h2>
<span class="date-range">
{{ date_to_weeks(user.userprofile.longest_streak_start,
user.userprofile.longest_streak_end) }} weeks<br>
{% if user.userprofile.longest_streak_start|is_date_today %}
{% if is_same_day(user.userprofile.longest_streak_start) %}
Today
{% elif is_same_day(user.userprofile.longest_streak_start,
user.userprofile.longest_streak_end) %}
{{ user.userprofile.longest_streak_start|strftime('%d %b %Y')}}
{% else %}
{{ user.userprofile.longest_streak_start|strftime('%d %b %Y')}}
&nbsp;-&nbsp;
Expand Down
6 changes: 3 additions & 3 deletions remo/reports/helpers.py
Expand Up @@ -13,9 +13,9 @@ def count_ng_reports(obj, current_streak=False, longest_streak=False,
longest_streak, period)


@register.filter
def is_date_today(date):
if date == utc_now().date():
@register.function
def is_same_day(first_date, second_date=None):
if first_date == (second_date or utc_now().date()):
return True
return False

Expand Down

0 comments on commit f754cb9

Please sign in to comment.