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

Add conditional for hiding bills with restricted views #394

Merged
merged 3 commits into from
Feb 11, 2019
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
5 changes: 4 additions & 1 deletion lametro/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def is_viewable(self):
This issue summarizes why that might happen: https://github.com/datamade/la-metro-councilmatic/issues/345#issuecomment-421184826
Metro staff devised three checks for knowing when to hide or show a report:

(1) Is the view restricted, i.e., is `MatterRestrictViewViaWeb` set to True in the Legistar API? We skip these bills further upstream. https://github.com/opencivicdata/scrapers-us-municipal/pull/251
(1) Is the view restricted, i.e., is `MatterRestrictViewViaWeb` set to True in the Legistar API? Then, do not show it.

(2) Does the Bill have a classification of "Board Box"? Then, show it.

Expand All @@ -96,6 +96,9 @@ def is_viewable(self):
This strategy minimizes complexity (e.g., attempting to implement an LAMetroBillManager),
and this strategy avoids making adjustments to the `data_integrity` script (https://github.com/datamade/django-councilmatic/blob/master/councilmatic_core/management/commands/data_integrity.py)
'''
if self.restrict_view == True:
return False

if self.bill_type == "Board Box":
return True

Expand Down
4 changes: 3 additions & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
[pytest]
DJANGO_SETTINGS_MODULE = tests.test_config
DJANGO_SETTINGS_MODULE = tests.test_config
filterwarnings =
ignore::django.utils.deprecation.RemovedInDjango20Warning
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:)

2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
psycopg2==2.7.6.1
django-councilmatic==0.10.11
django-councilmatic==0.10.14
django-debug-toolbar==1.9.1
raven==5.30.0
gunicorn==19.6.0
Expand Down
15 changes: 9 additions & 6 deletions tests/test_bills.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,22 @@ def test_format_full_text(bill, text, subject):

assert format_full_text(full_text) == subject

@pytest.mark.parametrize('bill_type,event_status,assertion', [
('Board Box', 'passed', True),
('Resolution', 'passed', True),
('Resolution', 'cancelled', True),
('Resolution', 'confirmed', False),
@pytest.mark.parametrize('restrict_view,bill_type,event_status,assertion', [
(True,'Board Box', 'passed', False),
(False,'Board Box', 'passed', True),
(False,'Resolution', 'passed', True),
(False,'Resolution', 'cancelled', True),
(False,'Resolution', 'confirmed', False),
])
def test_viewable_bill(bill,
event_agenda_item,
event_agenda_item,
restrict_view,
bill_type,
event_status,
assertion):
bill_info = {
'bill_type': bill_type,
'restrict_view': restrict_view,
}
bill = bill.build(**bill_info)
bill.refresh_from_db()
Expand Down