Skip to content

Commit 4cdaa00

Browse files
Virv12veluca93
authored andcommitted
ImportContest now updates the participations
1 parent ca513b7 commit 4cdaa00

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

cmscontrib/ImportContest.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -296,12 +296,6 @@ def _participation_to_db(
296296
.filter(Participation.contest_id == contest.id)
297297
.first()
298298
)
299-
# FIXME: detect if some details of the participation have been updated
300-
# and thus the existing participation needs to be changed.
301-
if p is not None:
302-
logger.warning("Participation of user %s in this contest already "
303-
"exists, not updating it.", new_p["username"])
304-
return p
305299

306300
# Prepare new participation
307301
args = {
@@ -319,6 +313,11 @@ def _participation_to_db(
319313
if "delay" in new_p:
320314
args["delay_time"] = datetime.timedelta(seconds=new_p["delay"])
321315

316+
if p is not None:
317+
for k, v in args.items():
318+
setattr(p, k, v)
319+
return p
320+
322321
new_p = Participation(**args)
323322
session.add(new_p)
324323
return new_p

0 commit comments

Comments
 (0)