Fixed get estimated kuk

master
Davide Bongiovanni 6 years ago
parent b535de925c
commit fcbc47b3ae

@ -85,7 +85,7 @@ def getUpcomingMeals():
meals[-1]['needs_confirmation'] = False meals[-1]['needs_confirmation'] = False
leaderboard = applyTempMeal(leaderboard, meals[-1]) leaderboard = applyTempMeal(leaderboard, meals[-1])
r.close() r.close()
return meals return meals, leaderboard
def applyTempMeal(leaderboard, meal): def applyTempMeal(leaderboard, meal):
ld = leaderboard[:] ld = leaderboard[:]
@ -156,7 +156,8 @@ def addme():
@app.route('/') @app.route('/')
def index(): def index():
return render_template('meal_list.html', leaderboard=getLeaderboard(), meals=getUpcomingMeals()) meals, _ = getUpcomingMeals()
return render_template('meal_list.html', leaderboard=getLeaderboard(), meals=meals)
@app.route('/viewmeal') @app.route('/viewmeal')
def view_meal(): def view_meal():
@ -191,11 +192,9 @@ def search_users():
def get_kuk_candidate(): def get_kuk_candidate():
date = datetime.datetime.strptime(request.args.get('date'), '%Y-%m-%d %H:%M') date = datetime.datetime.strptime(request.args.get('date'), '%Y-%m-%d %H:%M')
meal_eaters = request.args.get('eaters').split(',') meal_eaters = request.args.get('eaters').split(',')
u_meals = getUpcomingMeals() u_meals, t_lb = getUpcomingMeals()
leaderboard = getLeaderboard()
for meal in u_meals: return [e['name'] for e in t_lb if e['name'] in meal_eaters][0]
leaderboard = applyTempMeal(leaderboard, meal)
return [e['name'] for e in leaderboard if e['name'] in eaters][0]
@app.route('/login', methods=['GET', 'POST']) @app.route('/login', methods=['GET', 'POST'])
def login(): def login():

Loading…
Cancel
Save