adding me to meals

master^2
Marek Baczynski 6 years ago
parent 1061b7c08e
commit 259961da6e

@ -148,8 +148,9 @@ def addme():
results = [] results = []
for row in r: for row in r:
results.append(dict(row)) results.append(dict(row))
if not results[0]['is_eater'] == 'True':
if not results[0]['is_eater']: query = "UPDATE meals SET eaters = array_cat(eaters, '{:user_id}') where id=:meal_id;"
r = db_engine.execute(text(query), user_id=current_user.user_id, meal_id = meal_id)
return render_template('appresponse.html', message='Have a nice meal ' + meal_id + " mister " + str(current_user.name) ) return render_template('appresponse.html', message='Have a nice meal ' + meal_id + " mister " + str(current_user.name) )
else: else:
return render_template('appresponse.html', message='You are already a registered eater') return render_template('appresponse.html', message='You are already a registered eater')

Loading…
Cancel
Save