From aeba14f714c37c56611858ff9ebc9e7b15353bda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20H=C3=A4ublein?= Date: Mon, 16 Mar 2020 18:53:36 +0100 Subject: [PATCH] linting --- dashboard/templatetags/cards.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/dashboard/templatetags/cards.py b/dashboard/templatetags/cards.py index 52af5c2c..4cdf6b6b 100644 --- a/dashboard/templatetags/cards.py +++ b/dashboard/templatetags/cards.py @@ -240,15 +240,17 @@ def _feeding_statistics(child): """ feedings = [ { - 'start': timezone.now()-timezone.timedelta(days=3), - 'title': _('Feeding frequency')+ " 3 "+_("days") - }, - { - 'start': timezone.now()-timezone.timedelta(weeks=2), - 'title': _('Feeding frequency') + " 2 "+_("weeks") + 'start': timezone.now()-timezone.timedelta(days=3), + 'title': _('Feeding frequency (past 3 days)') }, { - 'start': timezone.make_aware(datetime.combine(date.min, time(0,0)) + timezone.timedelta(days=1) ), + 'start': timezone.now()-timezone.timedelta(weeks=2), + 'title': _('Feeding frequency (past 2 weeks)') + }, + { + 'start': timezone.make_aware( + datetime.combine(date.min, time(0, 0)) + + timezone.timedelta(days=1)), 'title': _('Feeding frequency') } ] @@ -264,7 +266,8 @@ def _feeding_statistics(child): if last_instance: for timespan in feedings: if last_instance.start > timespan['start']: - timespan['btwn_total'] += instance.start - last_instance.end + timespan['btwn_total'] += (instance.start + - last_instance.end) timespan['btwn_count'] += 1 last_instance = instance