|
|
@ -38,11 +38,20 @@ 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
|
|
|
|
|
|
|
|
if seconds_to_deadline < 0:
|
|
|
|
|
|
|
|
meals[-1]['selection_deadline'] = 'Deadline passed'
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
hours_td = round(seconds_to_deadline / 60 / 60)
|
|
|
|
|
|
|
|
days_td = hours_td / 24
|
|
|
|
|
|
|
|
hours_td = hours_td % 24
|
|
|
|
|
|
|
|
meals[-1]['selection_deadline'] = str(days_td) + ' days ' + str(hours_td)
|
|
|
|
r.close()
|
|
|
|
r.close()
|
|
|
|
return meals
|
|
|
|
return meals
|
|
|
|
|
|
|
|
|
|
|
|
@app.route('/')
|
|
|
|
@app.route('/')
|
|
|
|
def index():
|
|
|
|
def index():
|
|
|
|
|
|
|
|
print (getUpcomingMeals())
|
|
|
|
return render_template('meal_list.html', leaderboard=getLeaderboard(), meals=getUpcomingMeals(), current_user_name='Wille')
|
|
|
|
return render_template('meal_list.html', leaderboard=getLeaderboard(), meals=getUpcomingMeals(), current_user_name='Wille')
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
if __name__ == '__main__':
|
|
|
|