mirror of
				https://gitlab.com/questable/questable_bot
				synced 2025-10-31 20:30:05 +01:00 
			
		
		
		
	Move points calculation outside loop.
This commit is contained in:
		
							
								
								
									
										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)) | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user