Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

only create Amendment tasks from spreadsheet data #2227

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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