Skip to content

Commit

Permalink
Merge pull request #2227 from laws-africa/bulk-importer
Browse files Browse the repository at this point in the history
only create Amendment tasks from spreadsheet data
  • Loading branch information
goose-life authored Sep 6, 2024
2 parents 4b6c397 + 216ac9f commit 8f30657
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions indigo/bulk_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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.'),
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()]
Expand Down

0 comments on commit 8f30657

Please sign in to comment.