mirror of
https://gitlab.com/questable/questable_bot
synced 2025-04-02 21:36:52 +02:00
Move points calculation outside loop.
This commit is contained in:
parent
99c1795b93
commit
021467817b
12
server.py
12
server.py
@ -238,13 +238,15 @@ def update_quest(db):
|
||||
state = bool(request.values["state"])
|
||||
if state is True:
|
||||
quest.state = 1
|
||||
points = 55 + 10*quest.imp + 15*quest.diff
|
||||
player.add_points(points)
|
||||
else:
|
||||
return jsonify(errors._400_bv), 400
|
||||
except (ValueError):
|
||||
return jsonify(errors._400_bv), 400
|
||||
|
||||
if quest.state == 1:
|
||||
points = 55 + 10*quest.imp + 15*quest.diff
|
||||
player.add_points(points)
|
||||
|
||||
quest.update_db()
|
||||
return jsonify(dictify_quest(quest))
|
||||
|
||||
@ -295,13 +297,15 @@ def update_side_quest(db):
|
||||
state = bool(request.values["state"])
|
||||
if state is True:
|
||||
quest.state = 1
|
||||
points = 10*quest.imp + 15*quest.diff
|
||||
player.add_points(points)
|
||||
else:
|
||||
return jsonify(errors._400_bv), 400
|
||||
except (ValueError):
|
||||
return jsonify(errors._400_bv), 400
|
||||
|
||||
if quest.state == 1:
|
||||
points = 10*quest.imp + 15*quest.diff
|
||||
player.add_points(points)
|
||||
|
||||
quest.update_db()
|
||||
return jsonify(dictify_quest(quest))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user