-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #910 from fecgov/release/sprint-43
Release/sprint 43
- Loading branch information
Showing
32 changed files
with
352 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
cd django-backend | ||
|
||
# Run migrations and application | ||
./manage.py migrate --no-input --traceback --verbosity 3 > migrate.out && | ||
./manage.py migrate --no-input --traceback --verbosity 3 && | ||
python manage.py create_committee_views && | ||
gunicorn --bind 0.0.0.0:8080 fecfiler.wsgi -w 9 | ||
exec gunicorn --bind 0.0.0.0:8080 fecfiler.wsgi -w 9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from django.db.models import Case, When, Value | ||
from fecfiler.reports.models import Report | ||
|
||
report_code_label_mapping = { | ||
"Q1": "APRIL 15 QUARTERLY REPORT (Q1)", | ||
"Q2": "JULY 15 QUARTERLY REPORT (Q2)", | ||
"Q3": "OCTOBER 15 QUARTERLY REPORT (Q3)", | ||
"YE": "JANUARY 31 YEAR-END (YE)", | ||
"TER": "TERMINATION REPORT (TER)", | ||
"MY": "JULY 31 MID-YEAR REPORT (MY)", | ||
"12G": "12-DAY PRE-GENERAL (12G)", | ||
"12P": "12-DAY PRE-PRIMARY (12P)", | ||
"12R": "12-DAY PRE-RUNOFF (12R)", | ||
"12S": "12-DAY PRE-SPECIAL (12S)", | ||
"12C": "12-DAY PRE-CONVENTION (12C)", | ||
"30G": "30-DAY POST-GENERAL (30G)", | ||
"30R": "30-DAY POST-RUNOFF (30R)", | ||
"30S": "30-DAY POST-SPECIAL (30S)", | ||
"M2": "FEBRUARY 20 MONTHLY REPORT (M2)", | ||
"M3": "MARCH 20 MONTHLY REPORT (M3)", | ||
"M4": "APRIL 20 MONTHLY REPORT (M4)", | ||
"M5": "MAY 20 MONTHLY REPORT (M5)", | ||
"M6": "JUNE 20 MONTHLY REPORT (M6)", | ||
"M7": "JULY 20 MONTHLY REPORT (M7)", | ||
"M8": "AUGUST 20 MONTHLY REPORT (M8)", | ||
"M9": "SEPTEMBER 20 MONTHLY REPORT (M9)", | ||
"M10": "OCTOBER 20 MONTHLY REPORT (M10)", | ||
"M11": "NOVEMBER 20 MONTHLY REPORT (M11)", | ||
"M12": "DECEMBER 20 MONTHLY REPORT (M12)", | ||
} | ||
|
||
# Generate the Case object | ||
report_code_label_case = Case( | ||
*[When(report_code=k, then=Value(v)) for k, v in report_code_label_mapping.items()], | ||
When(form_24__report_type_24_48=24, then=Value("24 HOUR")), | ||
When(form_24__report_type_24_48=48, then=Value("48 HOUR")), | ||
When(form_99__isnull=False, then=Value("")), | ||
When(form_1m__isnull=False, then=Value("")), | ||
) | ||
|
||
|
||
def get_report_code_label(report: Report): | ||
if report.form_3x: | ||
return report_code_label_mapping[report.report_code] | ||
if report.form_24: | ||
return f"{report.form_24.report_type_24_48} HOUR" | ||
return "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
django-backend/fecfiler/transactions/migrations/0007_schedulee_so_candidate_state.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Generated by Django 4.2.11 on 2024-06-04 14:02 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("transactions", "0006_independent_expenditure_memos_no_aggregation_group"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="schedulee", | ||
name="so_candidate_state", | ||
field=models.TextField(blank=True, null=True), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
line_labels = {"SC/10": "10", "SC/9": "9"} | ||
line_labels = {"SC/10": "10", "SC/9": "09"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
line_labels = {"SD9": "9", "SD10": "10"} | ||
line_labels = {"SD9": "09", "SD10": "10"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 23 additions & 6 deletions
29
django-backend/fecfiler/transactions/schedule_e/tests/test_utils.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,39 @@ | ||
from django.test import TestCase | ||
from fecfiler.transactions.schedule_e.utils import add_schedule_e_contact_fields | ||
from fecfiler.transactions.tests.test_utils import get_test_transaction | ||
from fecfiler.transactions.schedule_e.models import ScheduleE | ||
|
||
|
||
class ScheduleEUtilsTestCase(TestCase): | ||
|
||
def test_contacts_to_representation(self): | ||
|
||
instance = get_test_transaction('INDEPENDENT_EXPENDITURE') | ||
instance = get_test_transaction("INDEPENDENT_EXPENDITURE") | ||
|
||
representation = dict( | ||
transaction_type_identifier='INDEPENDENT_EXPENDITURE' | ||
representation = dict(transaction_type_identifier="INDEPENDENT_EXPENDITURE") | ||
|
||
add_schedule_e_contact_fields(instance, representation) | ||
|
||
self.assertEquals( | ||
representation["transaction_type_identifier"], "INDEPENDENT_EXPENDITURE" | ||
) | ||
self.assertEquals(representation["payee_last_name"], "1 last name") | ||
self.assertEquals(representation["so_candidate_last_name"], "2 last name") | ||
self.assertEquals(representation["so_candidate_state"], "2 candidate state") | ||
|
||
def test_contacts_to_representation_primary_presidential(self): | ||
|
||
instance = get_test_transaction("INDEPENDENT_EXPENDITURE") | ||
instance.schedule_e = ScheduleE(election_code="P2024", so_candidate_state="CA") | ||
instance.contact_2.candidate_office = "P" | ||
|
||
representation = dict(transaction_type_identifier="INDEPENDENT_EXPENDITURE") | ||
|
||
add_schedule_e_contact_fields(instance, representation) | ||
|
||
self.assertEquals( | ||
representation['transaction_type_identifier'], 'INDEPENDENT_EXPENDITURE' | ||
representation["transaction_type_identifier"], "INDEPENDENT_EXPENDITURE" | ||
) | ||
self.assertEquals(representation['payee_last_name'], '1 last name') | ||
self.assertEquals(representation['so_candidate_last_name'], '2 last name') | ||
self.assertEquals(representation["payee_last_name"], "1 last name") | ||
self.assertEquals(representation["so_candidate_last_name"], "2 last name") | ||
self.assertEquals(representation["so_candidate_state"], "CA") |
Oops, something went wrong.