Standardize card language for "no data"

This commit is contained in:
Christopher C. Wells 2020-02-15 13:48:17 -08:00 committed by Christopher Charbonneau Wells
parent cb1712377b
commit 4d34a48652
8 changed files with 15 additions and 15 deletions

View File

@ -9,7 +9,7 @@
{{ time }} ago
{% endblocktrans %}
{% else %}
{% trans "Never" %}
{% trans "None" %}
{% endif %}
{% endblock %}

View File

@ -4,7 +4,11 @@
{% block header %}{% trans "Diaper Changes" %}{% endblock %}
{% block title %}
{% trans "Past Week" %}
{% if total == 0 %}
{% trans "None" %}
{% else %}
{% trans "Past Week" %}
{% endif %}
{% endblock %}
{% block content %}

View File

@ -9,7 +9,7 @@
{{ time }} ago
{% endblocktrans %}
{% else %}
{% trans "Never" %}
{% trans "None" %}
{% endif %}
{% endblock %}

View File

@ -7,9 +7,7 @@
{% if total %}
{{ total|duration_string }}
{% else %}
<i class="icon icon-sad" aria-hidden="true"></i>
{% trans "None yet today" %}
<i class="icon icon-sad" aria-hidden="true"></i>
{% trans "None" %}
{% endif %}
{% endblock %}

View File

@ -1,7 +1,7 @@
{% extends 'cards/base.html' %}
{% load duration i18n %}
{% block header %}{% trans "Last Slept" %}{% endblock %}
{% block header %}{% trans "Last Sleep" %}{% endblock %}
{% block title %}
{% if sleep %}
@ -9,7 +9,7 @@
{{ time }} ago
{% endblocktrans %}
{% else %}
{% trans "Never" %}
{% trans "None" %}
{% endif %}
{% endblock %}

View File

@ -9,9 +9,7 @@
{{ count }} nap{{ plural }}
{% endblocktrans %}
{% else %}
<i class="icon icon-sad" aria-hidden="true"></i>
{% trans "None yet today" %}
<i class="icon icon-sad" aria-hidden="true"></i>
{% trans "None" %}
{% endif %}
{% endblock %}

View File

@ -7,9 +7,7 @@
{% if stats.count > 0 %}
{{ stats.total|duration_string }}
{% else %}
<i class="icon icon-sad" aria-hidden="true"></i>
{% trans "None yet today" %}
<i class="icon icon-sad" aria-hidden="true"></i>
{% trans "None" %}
{% endif %}
{% endblock %}

View File

@ -38,6 +38,7 @@ def card_diaperchange_types(child, date=None):
time = timezone.datetime.combine(date, timezone.localtime().min.time())
time = timezone.make_aware(time)
stats = {}
week_total = 0
max_date = (time + timezone.timedelta(days=1)).replace(
hour=0, minute=0, second=0)
min_date = (max_date - timezone.timedelta(days=7)).replace(
@ -57,11 +58,12 @@ def card_diaperchange_types(child, date=None):
for key, info in stats.items():
total = info['wet'] + info['solid']
week_total += total
if total > 0:
stats[key]['wet_pct'] = info['wet'] / total * 100
stats[key]['solid_pct'] = info['solid'] / total * 100
return {'type': 'diaperchange', 'stats': stats}
return {'type': 'diaperchange', 'stats': stats, 'total': week_total}
@register.inclusion_tag('cards/feeding_last.html')