Fix range_hours while we're at it.
This commit is contained in:
		@@ -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:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user