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

Loading…
Cancel
Save