|
|
@ -49,14 +49,19 @@ def getUpcomingMeals():
|
|
|
|
meals = []
|
|
|
|
meals = []
|
|
|
|
for row in r:
|
|
|
|
for row in r:
|
|
|
|
meals.append(dict(row))
|
|
|
|
meals.append(dict(row))
|
|
|
|
seconds_to_deadline = (parse(meals[-1]['selection_deadline']) - datetime.datetime.now()).seconds
|
|
|
|
print (meals)
|
|
|
|
|
|
|
|
print ('deadline ' + str(meals[-1]['selection_deadline'] ))
|
|
|
|
|
|
|
|
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'
|
|
|
|
else:
|
|
|
|
elif seconds_to_deadline > 3600:
|
|
|
|
hours_td = round(seconds_to_deadline / 60 / 60)
|
|
|
|
hours_td = round(seconds_to_deadline / 3600)
|
|
|
|
days_td = hours_td / 24
|
|
|
|
days_td = int(hours_td / 24)
|
|
|
|
hours_td = hours_td % 24
|
|
|
|
hours_td = hours_td % 24
|
|
|
|
meals[-1]['selection_deadline'] = str(days_td) + ' days ' + str(hours_td)
|
|
|
|
meals[-1]['selection_deadline'] = str(days_td) + ' days ' + str(hours_td) + ' hours'
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
meals[-1]['selection_deadline'] = str(round(seconds_to_deadline / 60)) + ' minutes'
|
|
|
|
r.close()
|
|
|
|
r.close()
|
|
|
|
return meals
|
|
|
|
return meals
|
|
|
|
|
|
|
|
|
|
|
|