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

feature/1721 - Set reports.calculation_status to None whenever a transaction is updated #1156

Merged
merged 3 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion django-backend/fecfiler/transactions/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ def save(self, *args, **kwargs):
if self.memo_text:
self.memo_text.transaction_uuid = self.id
self.memo_text.save()

super(Transaction, self).save(*args, **kwargs)

def delete(self):
Expand Down
6 changes: 5 additions & 1 deletion django-backend/fecfiler/transactions/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ def get_previous(
return Response(response, status=status.HTTP_404_NOT_FOUND)

def save_transaction(self, transaction_data, request):
committee_id = request.session["committee_uuid"]
report_ids = transaction_data.pop("report_ids", [])
children = transaction_data.pop("children", [])
schedule = transaction_data.get("schedule_id")
Expand Down Expand Up @@ -278,7 +279,7 @@ def save_transaction(self, transaction_data, request):

contact_instances = {
contact_key: create_or_update_contact(
transaction_data, contact_key, request.session["committee_uuid"]
transaction_data, contact_key, committee_id
)
for contact_key in ["contact_1", "contact_2", "contact_3"]
if contact_key in transaction_data
Expand All @@ -305,6 +306,9 @@ def save_transaction(self, transaction_data, request):
schedule_instance.report_coverage_from_date = report.coverage_from_date
schedule_instance.save()

Report.objects.filter(committee_account_id=committee_id).update(
calculation_status=None
)
logger.info(
f"Transaction {transaction_instance.id} "
f"linked to report(s): {', '.join(report_ids)}"
Expand Down