fix: Cast user id to string before using it inside the flag
This commit is contained in:
@@ -18,14 +18,15 @@ bp = Blueprint(directory_name, __name__, template_folder="templates")
|
|||||||
|
|
||||||
|
|
||||||
def create_flag_if_missing(challenge_id: int, user_id: int, flag_content: str):
|
def create_flag_if_missing(challenge_id: int, user_id: int, flag_content: str):
|
||||||
flags = Flags.query.filter_by(id=challenge_id, data=user_id).all()
|
user_id_str = str(user_id)
|
||||||
|
flags = Flags.query.filter_by(id=challenge_id, data=user_id_str).all()
|
||||||
|
|
||||||
if len(flags) == 0:
|
if len(flags) == 0:
|
||||||
new_flag = Flags(
|
new_flag = Flags(
|
||||||
challenge_id=challenge_id,
|
challenge_id=challenge_id,
|
||||||
type="personal",
|
type="personal",
|
||||||
content=flag_content,
|
content=flag_content,
|
||||||
data=user_id,
|
data=user_id_str,
|
||||||
)
|
)
|
||||||
db.session.add(new_flag)
|
db.session.add(new_flag)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|||||||
Reference in New Issue
Block a user