7062 State Filters#7147
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #7147 +/- ##
========================================
Coverage 79.20% 79.20%
========================================
Files 255 255
Lines 6664 6666 +2
========================================
+ Hits 5278 5280 +2
Misses 1386 1386 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
patphongs
left a comment
There was a problem hiding this comment.
@rfultz Good work on this. Here's some fixes needed:
-
Need to update filters to
constants.states_territories, otherwise we get an error on territories like this: http://localhost:8000/data/elections/house/pr/00/2024/
fec-cms/fec/data/templatetags/filters.py
Line 120 in 781112a
-
Need to update to
constants.states_territories
-
Need to update to
constants.states_territories
-
Need to update to
constants.states_territories
-
Let's go ahead and update tests here to cover assertions for
state_fullwith territories and state lists that include territories. You'll also need to import from data the constants for these tests.
fec-cms/fec/data/tests/test_utils.py
Line 28 in 781112a
Example:
assert filters.fmt_state_full('pr') == 'Puerto Rico'
New test:
def test_state_lists_include_territories(self):
assert constants.territories['AS'] == 'American Samoa'
assert constants.states_territories['AS'] == 'American Samoa'
assert constants.states_all_contributors['AS'] == 'American Samoa'
| ('ZZ', 'Foreign Countries'), | ||
| }).items(), key=operator.itemgetter(1))) | ||
| ]) | ||
| territories = OrderedDict([ |
There was a problem hiding this comment.
This looks to be missing on the list of territories:
('AS', 'American Samoa'),
There was a problem hiding this comment.
Oooh, nice catch! (Looks like it's in the territories list as 'AS' and the countries list as 'ASM')
| {{ office.checkbox() }} | ||
| {{ parties.checkbox() }} | ||
| {{ states.field('state') }} | ||
| {{ states.field('state', list_type='states') }} |
There was a problem hiding this comment.
Need to update to list_type='states_territories'
| {{ parties.checkbox() }} | ||
| {% if table_context['office'] in ['senate', 'house'] %} | ||
| {{ states.field('state') }} | ||
| {{ states.field('state', list_type='states') }} |
There was a problem hiding this comment.
Need to update to list_type='states_territories'
Summary
Required reviewers
Impacted areas of the application
stateslists in constants.pystates_excl_territoriesin favor ofstatesarmed_forcesOrderedDictstates_territoriesOrderedDict (a combination of states and territories)states_all_contributorsOrderedDict (a combination of states, territories, armed forces, and ZZ)constants.states_territoriesinstead ofconstants.statesconstants.states_territoriesinstead ofconstants.statesstatesinstead ofstates_excl_territorieslist_type) to filters/states.jinja to use different (states, etc) listsScreenshots
They should all now look like…

Related PRs
None
How to test
npm ijust in casenpm run build./manage.py runserver