Fixed slight mistake in adding achievements

This commit is contained in:
Robbe Van Herck 2018-07-12 22:31:08 +02:00
parent 31483fdd2e
commit 4d452d47ea
No known key found for this signature in database
GPG key ID: 4D1C8E8FBD1C7188

View file

@ -12,12 +12,12 @@ def add_achievement(id):
name = request.args.get("name") name = request.args.get("name")
if not name: if not name:
return "No name supplied" return "No name supplied"
a = Achievement(name=name, achieved_by=current_user.id) achievement = Achievement(name=name, achieved_by=id)
db.session.add(a) achievement.endorsed_by.append(current_user)
db.session.add(achievement)
db.session.commit() db.session.commit()
return "OK" return "OK"
@app.route("/users/<id>") @app.route("/users/<id>")
def get_user(id): def get_user(id):
user = User.query.filter_by(id=id).first() user = User.query.filter_by(id=id).first()