Skip to content

Commit

Permalink
EHD-1136: Show list of ethnicities on each Ethnicity Classification p…
Browse files Browse the repository at this point in the history
…age: Show standard name, rather than display name
  • Loading branch information
jamesgriff committed Sep 24, 2024
1 parent 084ebbf commit 70bfa9c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ class EthnicityClassificationDataItem:
An ethnicity classification data item contains the return data for that
"""

def __init__(self, display_ethnicity, parent, order, required):
def __init__(self, standard_value, display_ethnicity, parent, order, required):
self.standard_value = standard_value
self.display_ethnicity = display_ethnicity
self.parent = parent
self.order = order
Expand Down Expand Up @@ -291,7 +292,7 @@ def __get_custom_classification(raw_ethnicities):
unique_raw_values = EthnicityClassification.__order_preserving_remove_duplicates(raw_ethnicities)
for ind, value in enumerate(unique_raw_values):
classification_data_item = EthnicityClassificationDataItem(
display_ethnicity=value, parent=value, order=ind, required=True
standard_value=value, display_ethnicity=value, parent=value, order=ind, required=True
)
classification.add_data_item_to_classification(value, classification_data_item)
return classification
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ def ethnicity_classification_from_data(id, name, data_rows, long_name=None):
def __classification_data_item_from_data(data_row):
item_is_required = get_bool(data_row[EthnicityClassificationDataColumn.REQUIRED])
return EthnicityClassificationDataItem(
standard_value=data_row[EthnicityClassificationDataColumn.STANDARD_VALUE],
display_ethnicity=data_row[EthnicityClassificationDataColumn.DISPLAY_VALUE],
parent=data_row[EthnicityClassificationDataColumn.PARENT],
order=data_row[EthnicityClassificationDataColumn.ORDER],
Expand All @@ -125,6 +126,7 @@ def __classification_from_complete_data(classification_id, complete_data):
def __classification_data_item_from_file_data_row(file_row):
item_is_required = get_bool(file_row[EthnicityClassificationFileColumn.REQUIRED])
return EthnicityClassificationDataItem(
standard_value=file_row[EthnicityClassificationFileColumn.STANDARD_VALUE],
display_ethnicity=file_row[EthnicityClassificationFileColumn.DISPLAY_VALUE],
parent=file_row[EthnicityClassificationFileColumn.PARENT],
order=file_row[EthnicityClassificationFileColumn.ORDER],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ <h1 class="govuk-heading-xl">{{ classification_title }}</h1>
{% for parent_ethnicity in parent_ethnicities %}
<tr class="govuk-table__row" style="background-color: lightgrey">
<th scope="row" class="govuk-table__header">
{{ parent_ethnicity.display_ethnicity }}
{{ parent_ethnicity.standard_value }}
</th>
<td class="govuk-table__cell">
{{ parent_ethnicity.required }}
Expand All @@ -103,7 +103,7 @@ <h1 class="govuk-heading-xl">{{ classification_title }}</h1>
{% if (child_ethnicity.parent == parent_ethnicity.display_ethnicity) and not (child_ethnicity.display_ethnicity == parent_ethnicity.display_ethnicity) %}
<tr class="govuk-table__row">
<th scope="row" class="govuk-table__header" style="padding-left: 20px;">
{{ child_ethnicity.display_ethnicity }}
{{ child_ethnicity.standard_value }}
</th>
<td class="govuk-table__cell">
{{ child_ethnicity.required }}
Expand Down

0 comments on commit 70bfa9c

Please sign in to comment.