fix(totals.py): correct handling of report end when it is available

Signed-off-by: Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com>
This commit is contained in:
Ankur Sinha (Ankur Sinha Gmail) 2023-05-25 10:55:44 +01:00 committed by Thomas Lauf
parent 99d18f42bb
commit 834af86d5b

View file

@ -110,7 +110,8 @@ def calculate_totals(input_stream):
if report_end_utc is not None:
j[-1]["end"] = min(report_end_utc, datetime.datetime.strptime(j[-1]["end"], DATEFORMAT).replace(tzinfo=from_zone)).strftime(DATEFORMAT)
else:
report_end = datetime.datetime.strptime(j[-1]["end"], DATEFORMAT).replace(tzinfo=from_zone)
report_end_utc = datetime.datetime.strptime(j[-1]["end"], DATEFORMAT).replace(tzinfo=from_zone)
report_end = report_end_utc.astimezone(tz=to_zone)
else:
if report_end_utc is not None:
j[-1]["end"] = min(report_end_utc, datetime.datetime.now(tz=from_zone)).strftime(DATEFORMAT)