fix: Change all() with first()

This commit is contained in:
2025-11-07 17:14:18 +01:00
parent 803bb45693
commit b72b373d8d

View File

@@ -19,9 +19,9 @@ bp = Blueprint(directory_name, __name__, template_folder="templates")
def create_flag_if_missing(challenge_id: int, user_id: int, flag_content: str):
user_id_str = str(user_id)
flags = Flags.query.filter_by(id=challenge_id, data=user_id_str).all()
flag = Flags.query.filter_by(id=challenge_id, data=user_id_str).first()
if len(flags) == 0:
if flag is None:
new_flag = Flags(
challenge_id=challenge_id,
type="personal",
@@ -32,7 +32,7 @@ def create_flag_if_missing(challenge_id: int, user_id: int, flag_content: str):
db.session.commit()
return new_flag.id
return flags[0].id
return flag
@bp.route("/admin/cheaters", methods=["GET"])