File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 )
You can’t perform that action at this time.
0 commit comments