Skip to content

Commit fc60db2

Browse files
committed
fix "started" line in symptom summary list
This should say "ago" after the relative dates
1 parent 78d0bba commit fc60db2

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

manage_breast_screening/mammograms/presenters/medical_information_presenter.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from manage_breast_screening.core.template_helpers import multiline_content
66
from manage_breast_screening.core.utils.date_formatting import format_approximate_date
77
from manage_breast_screening.participants.models.symptom import (
8+
RelativeDateChoices,
89
SymptomAreas,
910
SymptomType,
1011
)
@@ -33,10 +34,26 @@ def _present_symptom_area(symptom):
3334
location = symptom.get_area_display()
3435
return location
3536

37+
@staticmethod
38+
def _present_started(symptom):
39+
match symptom.when_started:
40+
case RelativeDateChoices.SINCE_A_SPECIFIC_DATE:
41+
if symptom.year_started is None or symptom.month_started is None:
42+
# Shouldn't happen unless there is a bug in data entry
43+
return "Since a specific date"
44+
45+
return format_approximate_date(
46+
symptom.year_started, symptom.month_started
47+
)
48+
case RelativeDateChoices.NOT_SURE:
49+
return "Not sure"
50+
case _:
51+
return symptom.get_when_started_display() + " ago"
52+
3653
@classmethod
3754
def from_symptom(cls, symptom):
3855
location = cls._present_symptom_area(symptom)
39-
started = symptom.get_when_started_display()
56+
started = cls._present_started(symptom)
4057
if symptom.year_started is not None and symptom.month_started is not None:
4158
started = format_approximate_date(
4259
symptom.year_started, symptom.month_started

manage_breast_screening/mammograms/tests/presenters/test_medical_information_presenter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def test_returns_symptoms(self, area, expected_location):
4141
symptom_type_id="lump",
4242
symptom_type_name="Lump",
4343
location_line=expected_location,
44-
started_line="Less than 3 months",
44+
started_line="Less than 3 months ago",
4545
investigated_line="Not investigated",
4646
),
4747
]
@@ -63,7 +63,7 @@ def test_formats_area(self):
6363
symptom_type_id="lump",
6464
symptom_type_name="Lump",
6565
location_line="Other: abc",
66-
started_line="Less than 3 months",
66+
started_line="Less than 3 months ago",
6767
investigated_line="Not investigated",
6868
),
6969
]
@@ -174,7 +174,7 @@ def test_formats_for_summary_list(self):
174174
"text": "Swelling or shape change",
175175
},
176176
"value": {
177-
"html": "Both breasts<br>Less than 3 months<br>Not investigated",
177+
"html": "Both breasts<br>Less than 3 months ago<br>Not investigated",
178178
},
179179
},
180180
]

0 commit comments

Comments
 (0)