aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Chudnick <sam@chudnick.com>2023-06-03 13:37:00 -0400
committerSam Chudnick <sam@chudnick.com>2023-06-03 13:37:00 -0400
commitbd094f94faf210785d19e005907c6673dde6409d (patch)
treea4aca3c2783dcbf256758027d11b085fa48d5246
parent18483e38bbdf92be7f2e33bf5dbb1c8ffc59f018 (diff)
Fixed counting error in fill_gaps function
-rw-r--r--library.py8
1 files 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 @@
1#!/usr/bin/env python3 1#!/usr/bin/env python3
2import datetime, requests, json, pytz 2import datetime, requests, json, pytz, sys
3from geopy.geocoders import Nominatim, GeoNames 3from geopy.geocoders import Nominatim, GeoNames
4 4
5def get_lat_long(location): 5def get_lat_long(location):
@@ -72,9 +72,9 @@ def fill_gaps(values):
72 ret.append(val) 72 ret.append(val)
73 duration_hours = int((val["duration"].seconds / 3600) + (val["duration"].days * 24)) 73 duration_hours = int((val["duration"].seconds / 3600) + (val["duration"].days * 24))
74 if duration_hours > 1: 74 if duration_hours > 1:
75 for _ in range(0, duration_hours - 1): 75 for i in range(1, duration_hours):
76 copy = val.copy() 76 copy = val.copy()
77 copy["time"] = val["time"] + datetime.timedelta(hours=1) 77 copy["time"] = val["time"] + datetime.timedelta(hours=i)
78 copy["duration"] = datetime.timedelta(hours=1) 78 copy["duration"] = datetime.timedelta(hours=1)
79 ret.append(copy) 79 ret.append(copy)
80 return ret 80 return ret
@@ -347,5 +347,3 @@ def get_hourly_data(raw_data, end_time):
347 i+=1 347 i+=1
348 348
349 return ret 349 return ret
350
351