Miscellaneous fixes #36

Merged
mattbk merged 3 commits from fix-on into master 2017-11-27 22:15:59 -06:00
2 changed files with 7 additions and 2 deletions
Showing only changes of commit e78148f358 - Show all commits

View File

@ -189,10 +189,13 @@ def get_records():
to_date_utc = arrow_time_to.strftime("%Y-%m-%d %H:%M")
from_date_str = arrow_time_from.to(timezone).strftime("%Y-%m-%d %H:%M")
to_date_str = arrow_time_to.to(timezone).strftime("%Y-%m-%d %H:%M")
range_hours = range_h_int
else:
#Convert datetimes to UTC so we can retrieve the appropriate records from the database
from_date_utc = arrow.get(from_date_obj, timezone).to('Etc/UTC').strftime("%Y-%m-%d %H:%M")
to_date_utc = arrow.get(to_date_obj, timezone).to('Etc/UTC').strftime("%Y-%m-%d %H:%M")
difference = (arrow.get(to_date_obj, timezone) - arrow.get(from_date_obj, timezone))
range_hours = (difference.total_seconds()) / 3600
conn = sqlite3.connect('pi_temp.db')
curs = conn.cursor()
@ -202,7 +205,7 @@ def get_records():
humidities = curs.fetchall()
conn.close()
return [temperatures, humidities, timezone, from_date_str, to_date_str, range_h_int]
return [temperatures, humidities, timezone, from_date_str, to_date_str, range_hours]
def validate_date(d):
try: