From bd094f94faf210785d19e005907c6673dde6409d Mon Sep 17 00:00:00 2001 From: Sam Chudnick Date: Sat, 3 Jun 2023 13:37:00 -0400 Subject: Fixed counting error in fill_gaps function --- library.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/library.py b/library.py index ff5735e..2c3fb86 100644 --- a/library.py +++ b/library.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -import datetime, requests, json, pytz +import datetime, requests, json, pytz, sys from geopy.geocoders import Nominatim, GeoNames def get_lat_long(location): @@ -72,9 +72,9 @@ def fill_gaps(values): ret.append(val) duration_hours = int((val["duration"].seconds / 3600) + (val["duration"].days * 24)) if duration_hours > 1: - for _ in range(0, duration_hours - 1): + for i in range(1, duration_hours): copy = val.copy() - copy["time"] = val["time"] + datetime.timedelta(hours=1) + copy["time"] = val["time"] + datetime.timedelta(hours=i) copy["duration"] = datetime.timedelta(hours=1) ret.append(copy) return ret @@ -347,5 +347,3 @@ def get_hourly_data(raw_data, end_time): i+=1 return ret - - -- cgit v1.2.3