Skip to content

Commit

Permalink
lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
osimuka committed Dec 18, 2024
1 parent 54eef42 commit eb52783
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
15 changes: 14 additions & 1 deletion barriers/forms/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@
from django.conf import settings
from django.http import QueryDict

from barriers.constants import DEPRECATED_TAGS, EXPORT_TYPES, STATUS_WITH_DATE_FILTER
from barriers.constants import (
DEPRECATED_TAGS,
EXPORT_TYPES,
STATUS_WITH_DATE_FILTER,
PRELIMINARY_ASSESSMENT_CHOICES,
)
from utils.forms.fields import MonthDateRangeField
from utils.helpers import format_dict_for_url_querystring

Expand Down Expand Up @@ -166,6 +171,11 @@ class BarrierSearchForm(forms.Form):
),
required=False,
)
preliminary_assessment = forms.MultipleChoiceField(
label="Preliminary economic assessment",
choices=PRELIMINARY_ASSESSMENT_CHOICES,
required=False,
)
economic_assessment_eligibility = forms.MultipleChoiceField(
label="Economic assessment eligibility",
choices=(
Expand Down Expand Up @@ -523,6 +533,9 @@ def get_api_search_parameters(self):
params["wto"] = ",".join(self.cleaned_data.get("wto", []))
params["archived"] = self.cleaned_data.get("only_archived") or "0"
params["public_view"] = ",".join(self.cleaned_data.get("public_view", []))
params["preliminary_assessment"] = ",".join(
self.cleaned_data.get("preliminary_assessment", [])
)
params["country_trading_bloc"] = ",".join(
self.cleaned_data.get("country_trading_bloc", [])
)
Expand Down
4 changes: 2 additions & 2 deletions templates/barriers/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ <h2 class="filter-list-title">Filter barriers by:</h2>
</div>
{% endif %}
{% include 'partials/forms/checkbox_filter.html' with field=form.public_view %}
{% include 'partials/forms/checkbox_filter.html' with field=form.economic_assessment_eligibility %}
{% include 'partials/forms/checkbox_filter.html' with field=form.economic_assessment %}
{% include 'partials/forms/checkbox_filter.html' with field=form.preliminary_assessment %}
{% include 'partials/forms/checkbox_filter.html' with field=form.economic_impact_assessment %}
{% include 'partials/forms/checkbox_filter.html' with field=form.valuation_assessment %}
{% include 'partials/forms/checkbox_filter.html' with field=form.commodity_code %}
Expand Down Expand Up @@ -168,6 +167,7 @@ <h3 class="visually-hidden">Active filters:</h3>
{% include 'barriers/partials/active_filter.html' with filter=filters.tags %}
{% include 'barriers/partials/active_filter.html' with filter=filters.show %}
{% include 'barriers/partials/active_filter.html' with filter=filters.public_view %}
{% include 'barriers/partials/active_filter.html' with filter=filters.preliminary_assessment %}
{% include 'barriers/partials/active_filter.html' with filter=filters.economic_assessment %}
{% include 'barriers/partials/active_filter.html' with filter=filters.economic_impact_assessment %}
{% include 'barriers/partials/active_filter.html' with filter=filters.commodity_code %}
Expand Down
3 changes: 3 additions & 0 deletions tests/barriers/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def test_search_filters(self, mock_list):
"3e6809d6-89f6-4590-8458-1d0dab73ad1a",
"5616ccf5-ab4a-4c2c-9624-13c69be3c46b",
],
"preliminary_assessment": ["1", "3"],
"status": ["2"],
"user": "1",
"ordering": "-reported",
Expand All @@ -118,6 +119,7 @@ def test_search_filters(self, mock_list):
]
assert form.cleaned_data["status"] == ["2"]
assert form.cleaned_data["user"] == "1"
assert form.cleaned_data["preliminary_assessment"] == ["1", "3"]

mock_list.assert_called_with(
ordering="-reported",
Expand All @@ -137,6 +139,7 @@ def test_search_filters(self, mock_list):
),
category="130,141",
policy_team="10,11",
preliminary_assessment="1,3",
status="2",
user="1",
archived="0",
Expand Down

0 comments on commit eb52783

Please sign in to comment.