Skip to content

Commit 78d0bba

Browse files
committed
show "other" details in symptom summary list
1 parent ac22b43 commit 78d0bba

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

manage_breast_screening/mammograms/presenters/medical_information_presenter.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44

55
from manage_breast_screening.core.template_helpers import multiline_content
66
from manage_breast_screening.core.utils.date_formatting import format_approximate_date
7-
from manage_breast_screening.participants.models.symptom import SymptomType
7+
from manage_breast_screening.participants.models.symptom import (
8+
SymptomAreas,
9+
SymptomType,
10+
)
811

912
from .appointment_presenters import AppointmentPresenter
1013

@@ -22,9 +25,17 @@ class PresentedSymptom:
2225
stopped_line: str = ""
2326
additional_information_line: str = ""
2427

28+
@staticmethod
29+
def _present_symptom_area(symptom):
30+
if symptom.area == SymptomAreas.OTHER and symptom.area_description:
31+
location = f"Other: {symptom.area_description}"
32+
else:
33+
location = symptom.get_area_display()
34+
return location
35+
2536
@classmethod
2637
def from_symptom(cls, symptom):
27-
location = symptom.get_area_display()
38+
location = cls._present_symptom_area(symptom)
2839
started = symptom.get_when_started_display()
2940
if symptom.year_started is not None and symptom.month_started is not None:
3041
started = format_approximate_date(

manage_breast_screening/mammograms/tests/presenters/test_medical_information_presenter.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,28 @@ def test_returns_symptoms(self, area, expected_location):
4646
),
4747
]
4848

49+
def test_formats_area(self):
50+
symptom = SymptomFactory.create(
51+
lump=True,
52+
when_started=RelativeDateChoices.LESS_THAN_THREE_MONTHS,
53+
area=SymptomAreas.OTHER,
54+
area_description="abc",
55+
)
56+
57+
presenter = MedicalInformationPresenter(symptom.appointment)
58+
59+
assert presenter.symptoms == [
60+
PresentedSymptom(
61+
id=symptom.id,
62+
appointment_id=symptom.appointment_id,
63+
symptom_type_id="lump",
64+
symptom_type_name="Lump",
65+
location_line="Other: abc",
66+
started_line="Less than 3 months",
67+
investigated_line="Not investigated",
68+
),
69+
]
70+
4971
def test_formats_investigation_and_specific_date(self):
5072
symptom = SymptomFactory.create(
5173
lump=True,

0 commit comments

Comments
 (0)