modified pumping amount graph

This commit is contained in:
John Merlie 2023-07-02 12:21:34 -04:00 committed by Christopher Charbonneau Wells
parent 725cfa77ba
commit 0697565ea1
1 changed files with 3 additions and 3 deletions

View File

@ -14,13 +14,13 @@ def pumping_amounts(objects):
:param instances: a QuerySet of Pumping instances. :param instances: a QuerySet of Pumping instances.
:returns: a tuple of the the graph's html and javascript. :returns: a tuple of the the graph's html and javascript.
""" """
objects = objects.order_by("time") objects = objects.order_by("start")
# We need to find date totals for annotations at the end # We need to find date totals for annotations at the end
curr_date = "" curr_date = ""
date_totals = {} date_totals = {}
for object in objects: for object in objects:
date_s = timezone.localtime(object.time) date_s = timezone.localtime(object.start)
date_s = str(date_s.date()) date_s = str(date_s.date())
if curr_date != date_s: if curr_date != date_s:
date_totals[date_s] = 0.0 date_totals[date_s] = 0.0
@ -31,7 +31,7 @@ def pumping_amounts(objects):
amounts = [] # Array of arrays containing amounts amounts = [] # Array of arrays containing amounts
index_x, index_y = 0, -1 index_x, index_y = 0, -1
for object in objects: for object in objects:
date_s = timezone.localtime(object.time) date_s = timezone.localtime(object.start)
date_s = str(date_s.date()) date_s = str(date_s.date())
if date_s not in dates: if date_s not in dates:
dates.append(date_s) dates.append(date_s)