From ee27f00bb4bc26ac612e43a6d9f4c092ee6838e1 Mon Sep 17 00:00:00 2001 From: Elaine Krauss Date: Wed, 10 Apr 2024 12:37:47 -0400 Subject: [PATCH 1/3] Updates validator commit hash; IE Memos no longer have an aggregation group --- ..._expenditure_memos_no_aggregation_group.py | 45 +++++++++++++++++++ requirements.txt | 2 +- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 django-backend/fecfiler/transactions/migrations/0006_independent_expenditure_memos_no_aggregation_group.py diff --git a/django-backend/fecfiler/transactions/migrations/0006_independent_expenditure_memos_no_aggregation_group.py b/django-backend/fecfiler/transactions/migrations/0006_independent_expenditure_memos_no_aggregation_group.py new file mode 100644 index 000000000..39c1d71be --- /dev/null +++ b/django-backend/fecfiler/transactions/migrations/0006_independent_expenditure_memos_no_aggregation_group.py @@ -0,0 +1,45 @@ +# Generated by Django 4.2.10 on 2024-03-25 16:45 + +from django.db import migrations +from django.db.models import Q + + +def set_aggregation_group_to_none_for_ie_memos(apps, schema_editor): + transaction_model = apps.get_model("transactions", "Transaction") + + for transaction in transaction_model.objects.filter( + Q(transaction_type_identifier__in=[ + "INDEPENDENT_EXPENDITURE_CREDIT_CARD_PAYMENT_MEMO", + "INDEPENDENT_EXPENDITURE_STAFF_REIMBURSEMENT_MEMO", + "INDEPENDENT_EXPENDITURE_PAYMENT_TO_PAYROLL_MEMO" + ]) + ): + transaction.aggregation_group = None + transaction.save() + +def reverse_removing_aggregation_group_for_ie_memos(apps, schema_editor): + transaction_model = apps.get_model("transactions", "Transaction") + + for transaction in transaction_model.objects.filter( + Q(transaction_type_identifier__in=[ + "INDEPENDENT_EXPENDITURE_CREDIT_CARD_PAYMENT_MEMO", + "INDEPENDENT_EXPENDITURE_STAFF_REIMBURSEMENT_MEMO", + "INDEPENDENT_EXPENDITURE_PAYMENT_TO_PAYROLL_MEMO" + ]) + ): + transaction.aggregation_group = "INDEPENDENT_EXPENDITURE" + transaction.save() + + +class Migration(migrations.Migration): + + dependencies = [ + ("transactions", "0005_schedulec_report_coverage_from_date_and_more"), + ] + + operations = [ + migrations.RunPython( + set_aggregation_group_to_none_for_ie_memos, + reverse_removing_aggregation_group_for_ie_memos, + ), + ] diff --git a/requirements.txt b/requirements.txt index ab1bb4e48..7698a96b5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,7 +11,7 @@ django-cors-headers==3.13.0 django-storages==1.13.1 djangorestframework==3.14.0 drf-spectacular==0.24.2 -git+https://github.com/fecgov/fecfile-validate@e36a2eff869a6adc97a9e812f028d0b8f18ec3a3#egg=fecfile_validate&subdirectory=fecfile_validate_python +git+https://github.com/fecgov/fecfile-validate@c67e1789421c5e5e6a9ede0fc9321e1c4d624ca8#egg=fecfile_validate&subdirectory=fecfile_validate_python GitPython==3.1.42 gunicorn==20.1.0 invoke==1.7.3 From f4a68e5cf214f6e8fef4043e38dbf789c3e56fab Mon Sep 17 00:00:00 2001 From: Elaine Krauss Date: Wed, 10 Apr 2024 12:44:48 -0400 Subject: [PATCH 2/3] Makes linting fixes --- .../0006_independent_expenditure_memos_no_aggregation_group.py | 1 + 1 file changed, 1 insertion(+) diff --git a/django-backend/fecfiler/transactions/migrations/0006_independent_expenditure_memos_no_aggregation_group.py b/django-backend/fecfiler/transactions/migrations/0006_independent_expenditure_memos_no_aggregation_group.py index 39c1d71be..f984bba5e 100644 --- a/django-backend/fecfiler/transactions/migrations/0006_independent_expenditure_memos_no_aggregation_group.py +++ b/django-backend/fecfiler/transactions/migrations/0006_independent_expenditure_memos_no_aggregation_group.py @@ -17,6 +17,7 @@ def set_aggregation_group_to_none_for_ie_memos(apps, schema_editor): transaction.aggregation_group = None transaction.save() + def reverse_removing_aggregation_group_for_ie_memos(apps, schema_editor): transaction_model = apps.get_model("transactions", "Transaction") From 983c2b5f707c6d225087788d637ed7e1cde00f8b Mon Sep 17 00:00:00 2001 From: Matt Travers Date: Thu, 18 Apr 2024 10:58:47 -0400 Subject: [PATCH 3/3] Update validate commit hash --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 7698a96b5..4ef106655 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,7 +11,7 @@ django-cors-headers==3.13.0 django-storages==1.13.1 djangorestframework==3.14.0 drf-spectacular==0.24.2 -git+https://github.com/fecgov/fecfile-validate@c67e1789421c5e5e6a9ede0fc9321e1c4d624ca8#egg=fecfile_validate&subdirectory=fecfile_validate_python +git+https://github.com/fecgov/fecfile-validate@dd3de14672d1b3c7569d8b092ef80712b5516c01#egg=fecfile_validate&subdirectory=fecfile_validate_python GitPython==3.1.42 gunicorn==20.1.0 invoke==1.7.3