File tree Expand file tree Collapse file tree 2 files changed +6
-0
lines changed
cms/server/admin/handlers Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -500,16 +500,19 @@ def delete(self, task_id):
500500 num = task .num
501501
502502 self .sql_session .delete (task )
503+ self .sql_session .flush ()
503504 # Keeping the tasks' nums to the range 0... n - 1.
504505 if contest_id is not None :
505506 following_tasks : list [Task ] = (
506507 self .sql_session .query (Task )
507508 .filter (Task .contest_id == contest_id )
508509 .filter (Task .num > num )
510+ .order_by (Task .num )
509511 .all ()
510512 )
511513 for task in following_tasks :
512514 task .num -= 1
515+ self .sql_session .flush ()
513516 if self .try_commit ():
514517 self .service .proxy_service .reinitialize ()
515518
Original file line number Diff line number Diff line change @@ -47,14 +47,17 @@ def remove_task(task_name: str):
4747 num = task .num
4848 contest_id = task .contest_id
4949 session .delete (task )
50+ session .flush ()
5051 # Keeping the tasks' nums to the range 0... n - 1.
5152 if contest_id is not None :
5253 following_tasks = session .query (Task )\
5354 .filter (Task .contest_id == contest_id )\
5455 .filter (Task .num > num )\
56+ .order_by (Task .num )\
5557 .all ()
5658 for task in following_tasks :
5759 task .num -= 1
60+ session .flush ()
5861 session .commit ()
5962 print ("Task `%s' removed." % task_name )
6063
You can’t perform that action at this time.
0 commit comments