|
|
@ -64,16 +64,16 @@ def getUpcomingMeals():
|
|
|
|
meals.append(dict(row))
|
|
|
|
meals.append(dict(row))
|
|
|
|
seconds_to_deadline = (meals[-1]['selection_deadline'] - datetime.datetime.now()).total_seconds()
|
|
|
|
seconds_to_deadline = (meals[-1]['selection_deadline'] - datetime.datetime.now()).total_seconds()
|
|
|
|
if seconds_to_deadline < 0:
|
|
|
|
if seconds_to_deadline < 0:
|
|
|
|
meals[-1]['selection_deadline'] = 'Deadline passed'
|
|
|
|
meals[-1]['friendly_selection_deadline'] = ''
|
|
|
|
elif seconds_to_deadline > 3600:
|
|
|
|
elif seconds_to_deadline > 3600:
|
|
|
|
hours_td = round(seconds_to_deadline / 3600)
|
|
|
|
hours_td = round(seconds_to_deadline / 3600)
|
|
|
|
days_td = int(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) + ' hours'
|
|
|
|
meals[-1]['friendly_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]['friendly_selection_deadline'] = str(round(seconds_to_deadline / 60)) + ' minutes'
|
|
|
|
meals[-1]['meal_time'] = meals[-1]['meal_date'].strftime('%H:%M')
|
|
|
|
meals[-1]['meal_time'] = meals[-1]['meal_date'].strftime('%H:%M')
|
|
|
|
meals[-1]['meal_date'] = meals[-1]['meal_date'].strftime('%A %d %B')
|
|
|
|
meals[-1]['meal_friendly_date'] = meals[-1]['meal_date'].strftime('%A %d %B')
|
|
|
|
meals[-1]['candidate'] = 'davide'
|
|
|
|
meals[-1]['candidate'] = 'davide'
|
|
|
|
r.close()
|
|
|
|
r.close()
|
|
|
|
return meals
|
|
|
|
return meals
|
|
|
|