From 5a57ac7a48c72ea6cba5c64c5d3067116f36a9d6 Mon Sep 17 00:00:00 2001 From: Christopher Charbonneau Wells Date: Sun, 19 Nov 2017 11:01:38 -0500 Subject: [PATCH] Update naps card to pass timedelta directly. --- dashboard/templates/cards/sleep_naps_day.html | 2 +- dashboard/templatetags/cards.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dashboard/templates/cards/sleep_naps_day.html b/dashboard/templates/cards/sleep_naps_day.html index 4dbbac0b..2c5795b0 100644 --- a/dashboard/templates/cards/sleep_naps_day.html +++ b/dashboard/templates/cards/sleep_naps_day.html @@ -14,5 +14,5 @@ {% endblock %} {% block content %} - {% if total.duration__sum %}{{ total.duration__sum|duration_string }}{% endif %} + {% if total %}{{ total|duration_string }}{% endif %} {% endblock %} \ No newline at end of file diff --git a/dashboard/templatetags/cards.py b/dashboard/templatetags/cards.py index 73c39b30..784262d6 100644 --- a/dashboard/templatetags/cards.py +++ b/dashboard/templatetags/cards.py @@ -148,7 +148,7 @@ def card_sleep_naps_day(child, date=None): instances = models.Sleep.naps.filter(child=child, start__date=date) return { 'type': 'sleep', - 'total': instances.aggregate(Sum('duration')), + 'total': instances.aggregate(Sum('duration'))['duration__sum'], 'count': len(instances)}