@ -49,10 +49,7 @@ def getUpcomingMeals():
meals = [ ]
meals = [ ]
for row in r :
for row in r :
meals . append ( dict ( row ) )
meals . append ( dict ( row ) )
print ( meals )
print ( ' deadline ' + str ( meals [ - 1 ] [ ' selection_deadline ' ] ) )
seconds_to_deadline = ( meals [ - 1 ] [ ' selection_deadline ' ] - datetime . datetime . now ( ) ) . total_seconds ( )
seconds_to_deadline = ( meals [ - 1 ] [ ' selection_deadline ' ] - datetime . datetime . now ( ) ) . total_seconds ( )
print ( str ( seconds_to_deadline ) + ' s to dead ' )
if seconds_to_deadline < 0 :
if seconds_to_deadline < 0 :
meals [ - 1 ] [ ' selection_deadline ' ] = ' Deadline passed '
meals [ - 1 ] [ ' selection_deadline ' ] = ' Deadline passed '
elif seconds_to_deadline > 3600 :
elif seconds_to_deadline > 3600 :
@ -62,6 +59,8 @@ def getUpcomingMeals():
meals [ - 1 ] [ ' selection_deadline ' ] = str ( days_td ) + ' days ' + str ( hours_td ) + ' hours '
meals [ - 1 ] [ ' selection_deadline ' ] = str ( days_td ) + ' days ' + str ( hours_td ) + ' hours '
else :
else :
meals [ - 1 ] [ ' selection_deadline ' ] = str ( round ( seconds_to_deadline / 60 ) ) + ' minutes '
meals [ - 1 ] [ ' selection_deadline ' ] = str ( round ( seconds_to_deadline / 60 ) ) + ' minutes '
meals [ - 1 ] [ ' meal_time ' ] = meals [ - 1 ] [ ' meal_date ' ] . strftime ( ' % H: % M ' )
meals [ - 1 ] [ ' meal_date ' ] = meals [ - 1 ] [ ' meal_date ' ] . strftime ( ' % A %d % B ' )
r . close ( )
r . close ( )
return meals
return meals