From 216ac9fb00011f5bbba01ef5cd05455fe200ef68 Mon Sep 17 00:00:00 2001 From: goose-life <32566441+goose-life@users.noreply.github.com> Date: Thu, 5 Sep 2024 17:11:41 +0200 Subject: [PATCH] only create Amendment tasks from spreadsheet data --- indigo/bulk_creator.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/indigo/bulk_creator.py b/indigo/bulk_creator.py index b19b535a9..ffa12b1dc 100644 --- a/indigo/bulk_creator.py +++ b/indigo/bulk_creator.py @@ -396,6 +396,7 @@ def create_works(self, table, dry_run, form_data): self.dry_run = dry_run self.works = [] + self.amendments = [] rows = self.get_rows_from_table(table) @@ -412,6 +413,8 @@ def create_works(self, table, dry_run, form_data): def create_main_tasks(self): works = Work.objects.filter(pk__in=[w.work.pk for w in self.works if hasattr(w, 'work')]) broker = self.broker_class(works) + # override amendments -- only use the ones in the spreadsheet + broker.amendments = self.amendments # fake form data for the broker data = { 'conversion_task_description': _('Convert the input file into a .docx file and remove automatic numbering.'), @@ -892,10 +895,8 @@ def link_amendment_passive(self, row): }, ) - if new: - self.create_task(row.work, row, - task_type='apply-amendment', - amendment=amendment) + # stash for tasks later + self.amendments.append(amendment) def link_amendment_active(self, row): # if the work `amends` something, try linking it (or them) @@ -930,10 +931,8 @@ def link_amendment_active(self, row): }, ) - if new: - self.create_task(amended_work, row, - task_type='apply-amendment', - amendment=amendment) + # stash for tasks later + self.amendments.append(amendment) def link_taxonomy(self, row): topics = [x.strip() for x in row.taxonomy_topic.split(';') if x.strip()]