diff --git a/mo/jobs/notify.py b/mo/jobs/notify.py index 0616855d659449bdf3e4dd968aadee7cef6d7e1c..f32b9e09054e43224f031d02e4a6a6bd66a03a86 100644 --- a/mo/jobs/notify.py +++ b/mo/jobs/notify.py @@ -40,17 +40,20 @@ def schedule_send_grading_info(round: db.Round, contests: Optional[List[db.Conte the_job = TheJob() job = the_job.create(db.JobType.send_grading_info, for_user) job.description = f'E-maily účastníkům {round.round_code_short()}' - job.in_json = { + # XXX: SQLAlchemy neumí modifikovat obsah JSONových sloupců, jen celý obsah vyměnit za jiný. + # Proto slovník nejdřív připravíme, a teprve pak uložíme do job.in_json. + in_params = { 'round_id': round.round_id, 'contest_ids': None, 'new_state': new_state.name, } if contests is not None: - job.in_json['contest_ids'] = [c.contest_id for c in contests] + in_params['contest_ids'] = [c.contest_id for c in contests] if len(contests) == 1: job.description += f' {contests[0].place.name_locative()}' else: job.description += ' (' + inflect_number(len(contests), 'soutěž', 'soutěže', 'soutěží') + ')' + job.in_json = in_params the_job.submit() return True