Skip to content

Commit 6411ec3

Browse files
authored
Merge branch 'main' into add-counter
2 parents 1134711 + 4cdaa00 commit 6411ec3

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

cmscontrib/ImportContest.py

Lines changed: 7 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 = {
@@ -316,6 +310,13 @@ def _participation_to_db(
316310
args["ip"] = list(map(ipaddress.ip_network, new_p["ip"].split(",")))
317311
if "password" in new_p:
318312
args["password"] = new_p["password"]
313+
if "delay" in new_p:
314+
args["delay_time"] = datetime.timedelta(seconds=new_p["delay"])
315+
316+
if p is not None:
317+
for k, v in args.items():
318+
setattr(p, k, v)
319+
return p
319320

320321
new_p = Participation(**args)
321322
session.add(new_p)

0 commit comments

Comments
 (0)