From 3a85ff82b4982848d14d59f530d22639315eebfc Mon Sep 17 00:00:00 2001 From: Filippo Casarin Date: Tue, 23 Dec 2025 15:16:45 +0100 Subject: [PATCH] ImportContest now updates the participations --- cmscontrib/ImportContest.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/cmscontrib/ImportContest.py b/cmscontrib/ImportContest.py index 9bc9713859..bc855ecc3b 100755 --- a/cmscontrib/ImportContest.py +++ b/cmscontrib/ImportContest.py @@ -296,12 +296,6 @@ def _participation_to_db( .filter(Participation.contest_id == contest.id) .first() ) - # FIXME: detect if some details of the participation have been updated - # and thus the existing participation needs to be changed. - if p is not None: - logger.warning("Participation of user %s in this contest already " - "exists, not updating it.", new_p["username"]) - return p # Prepare new participation args = { @@ -319,6 +313,11 @@ def _participation_to_db( if "delay" in new_p: args["delay_time"] = datetime.timedelta(seconds=new_p["delay"]) + if p is not None: + for k, v in args.items(): + setattr(p, k, v) + return p + new_p = Participation(**args) session.add(new_p) return new_p