Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -165,17 +165,6 @@
"items": []
}
},
{
"key": {
"text": "Non-cancerous lump diagnosis"
},
"value": {
"html": non_cancerous_lump_diagnosis_link
},
"actions": {
"items": []
}
},
{
"key": {
"text": "Mastectomy or lumpectomy history"
Expand All @@ -186,17 +175,6 @@
"actions": {
"items": []
}
},
{
"key": {
"text": "Other breast or chest procedures"
},
"value": {
"html": chest_procedures_link
},
"actions": {
"items": []
}
}
]
}) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ def current_status(self):
colour = status_colour(current_status.state)

return {
"classes": f"nhsuk-tag--{colour} app-u-nowrap"
if colour
else "app-u-nowrap",
"classes": (
f"nhsuk-tag--{colour} app-u-nowrap" if colour else "app-u-nowrap"
),
"text": current_status.get_state_display(),
"key": current_status.state,
"is_confirmed": current_status.state == AppointmentStatus.CONFIRMED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@


class BenignLumpHistoryItemPresenter:
def __init__(self, benign_lump_history_item):
def __init__(self, benign_lump_history_item, counter=None):
self._item = benign_lump_history_item
self.counter = counter
self.right_breast_procedures = self._format_multiple_choices(
self._item.right_breast_procedures, BenignLumpHistoryItem.Procedure
)
Expand Down Expand Up @@ -63,6 +64,11 @@ def change_link(self):
},
),
"text": "Change",
"visually_hidden_text": (
f" benign lump item {self.counter}"
if self.counter
else " benign lump item"
),
}

def _format_multiple_choices(self, choices, ChoiceClass):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
from django.urls import reverse

from manage_breast_screening.mammograms.presenters.benign_lump_history_item_presenter import (
from manage_breast_screening.mammograms.presenters.medical_history.benign_lump_history_item_presenter import (
BenignLumpHistoryItemPresenter,
)
from manage_breast_screening.mammograms.presenters.breast_augmentation_history_item_presenter import (
from manage_breast_screening.mammograms.presenters.medical_history.breast_augmentation_history_item_presenter import (
BreastAugmentationHistoryItemPresenter,
)
from manage_breast_screening.mammograms.presenters.breast_cancer_history_item_presenter import (
from manage_breast_screening.mammograms.presenters.medical_history.breast_cancer_history_item_presenter import (
BreastCancerHistoryItemPresenter,
)
from manage_breast_screening.mammograms.presenters.cyst_history_item_presenter import (
from manage_breast_screening.mammograms.presenters.medical_history.cyst_history_item_presenter import (
CystHistoryItemPresenter,
)
from manage_breast_screening.mammograms.presenters.implanted_medical_device_history_item_presenter import (
from manage_breast_screening.mammograms.presenters.medical_history.implanted_medical_device_history_item_presenter import (
ImplantedMedicalDeviceHistoryItemPresenter,
)
from manage_breast_screening.mammograms.presenters.mastectomy_or_lumpectomy_history_item_presenter import (
from manage_breast_screening.mammograms.presenters.medical_history.mastectomy_or_lumpectomy_history_item_presenter import (
MastectomyOrLumpectomyHistoryItemPresenter,
)
from manage_breast_screening.mammograms.presenters.other_procedure_history_item_presenter import (
from manage_breast_screening.mammograms.presenters.medical_history.other_procedure_history_item_presenter import (
OtherProcedureHistoryItemPresenter,
)
from manage_breast_screening.mammograms.presenters.symptom_presenter import (
Expand All @@ -35,6 +35,7 @@ def __init__(self, appointment):
"symptom_type__name", "reported_at"
)
self.symptoms = [SymptomPresenter(symptom) for symptom in symptoms]

self.breast_cancer_history = self._present_items(
appointment.breast_cancer_history_items.all(),
BreastCancerHistoryItemPresenter,
Expand All @@ -60,10 +61,9 @@ def __init__(self, appointment):
OtherProcedureHistoryItemPresenter,
)

self.benign_lump_history = [
BenignLumpHistoryItemPresenter(item)
for item in appointment.benign_lump_history_items.all()
]
self.benign_lump_history = self._present_items(
appointment.benign_lump_history_items.all(), BenignLumpHistoryItemPresenter
)

self.cyst_history = self._present_items(
appointment.cyst_history_items.all(), CystHistoryItemPresenter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from manage_breast_screening.mammograms.presenters.benign_lump_history_item_presenter import (
from manage_breast_screening.mammograms.presenters.medical_history.benign_lump_history_item_presenter import (
BenignLumpHistoryItemPresenter,
)
from manage_breast_screening.participants.models.medical_history.benign_lump_history_item import (
Expand Down Expand Up @@ -62,4 +62,15 @@ def test_change_link(self):
assert result == {
"href": f"/mammograms/{item.appointment_id}/record-medical-information/benign-lump-history/{item.id}/",
"text": "Change",
"visually_hidden_text": " benign lump item",
}

def test_change_link_with_counter(self):
item = BenignLumpHistoryItemFactory.build()

presenter = BenignLumpHistoryItemPresenter(item, counter=2)
assert presenter.change_link == {
"href": f"/mammograms/{item.appointment_id}/record-medical-information/benign-lump-history/{item.pk}/",
"text": "Change",
"visually_hidden_text": " benign lump item 2",
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from manage_breast_screening.mammograms.presenters.breast_augmentation_history_item_presenter import (
from manage_breast_screening.mammograms.presenters.medical_history.breast_augmentation_history_item_presenter import (
BreastAugmentationHistoryItemPresenter,
)
from manage_breast_screening.participants.models.medical_history.breast_augmentation_history_item import (
Expand Down Expand Up @@ -65,7 +65,7 @@ def test_change_link(self):

presenter = BreastAugmentationHistoryItemPresenter(item)
assert presenter.change_link == {
"href": f"/mammograms/{item.appointment_id}/record-medical-information/breast-augmentation-history/{item.pk}",
"href": f"/mammograms/{item.appointment_id}/record-medical-information/breast-augmentation-history/{item.pk}/",
"text": "Change",
"visually_hidden_text": " breast implants or augmentation item",
}
Expand All @@ -75,7 +75,7 @@ def test_change_link_with_counter(self):

presenter = BreastAugmentationHistoryItemPresenter(item, counter=2)
assert presenter.change_link == {
"href": f"/mammograms/{item.appointment_id}/record-medical-information/breast-augmentation-history/{item.pk}",
"href": f"/mammograms/{item.appointment_id}/record-medical-information/breast-augmentation-history/{item.pk}/",
"text": "Change",
"visually_hidden_text": " breast implants or augmentation item 2",
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from manage_breast_screening.mammograms.presenters.breast_cancer_history_item_presenter import (
from manage_breast_screening.mammograms.presenters.medical_history.breast_cancer_history_item_presenter import (
BreastCancerHistoryItemPresenter,
)
from manage_breast_screening.participants.models.medical_history.breast_cancer_history_item import (
Expand Down Expand Up @@ -79,7 +79,7 @@ def test_change_link(self):

presenter = BreastCancerHistoryItemPresenter(item)
assert presenter.change_link == {
"href": f"/mammograms/{item.appointment_id}/record-medical-information/breast-cancer-history/{item.pk}",
"href": f"/mammograms/{item.appointment_id}/record-medical-information/breast-cancer-history/{item.pk}/",
"text": "Change",
"visually_hidden_text": " breast cancer item",
}
Expand All @@ -89,7 +89,7 @@ def test_change_link_with_counter(self):

presenter = BreastCancerHistoryItemPresenter(item, counter=2)
assert presenter.change_link == {
"href": f"/mammograms/{item.appointment_id}/record-medical-information/breast-cancer-history/{item.pk}",
"href": f"/mammograms/{item.appointment_id}/record-medical-information/breast-cancer-history/{item.pk}/",
"text": "Change",
"visually_hidden_text": " breast cancer item 2",
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from manage_breast_screening.mammograms.presenters.cyst_history_item_presenter import (
from manage_breast_screening.mammograms.presenters.medical_history.cyst_history_item_presenter import (
CystHistoryItemPresenter,
)
from manage_breast_screening.participants.models.medical_history.cyst_history_item import (
Expand Down Expand Up @@ -44,7 +44,7 @@ def test_change_link(self):

presenter = CystHistoryItemPresenter(item)
assert presenter.change_link == {
"href": f"/mammograms/{item.appointment_id}/record-medical-information/cyst-history/{item.pk}",
"href": f"/mammograms/{item.appointment_id}/record-medical-information/cyst-history/{item.pk}/",
"text": "Change",
"visually_hidden_text": " cyst item",
}
Expand All @@ -57,7 +57,7 @@ def test_change_link_with_counter(self):

presenter = CystHistoryItemPresenter(item, counter=2)
assert presenter.change_link == {
"href": f"/mammograms/{item.appointment_id}/record-medical-information/cyst-history/{item.pk}",
"href": f"/mammograms/{item.appointment_id}/record-medical-information/cyst-history/{item.pk}/",
"text": "Change",
"visually_hidden_text": " cyst item 2",
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from manage_breast_screening.mammograms.presenters.implanted_medical_device_history_item_presenter import (
from manage_breast_screening.mammograms.presenters.medical_history.implanted_medical_device_history_item_presenter import (
ImplantedMedicalDeviceHistoryItemPresenter,
)
from manage_breast_screening.participants.models.medical_history.implanted_medical_device_history_item import (
Expand Down Expand Up @@ -74,7 +74,7 @@ def test_change_link(self):

presenter = ImplantedMedicalDeviceHistoryItemPresenter(item)
assert presenter.change_link == {
"href": f"/mammograms/{item.appointment_id}/record-medical-information/implanted-medical-device-history/{item.pk}",
"href": f"/mammograms/{item.appointment_id}/record-medical-information/implanted-medical-device-history/{item.pk}/",
"text": "Change",
"visually_hidden_text": " implanted medical device item",
}
Expand All @@ -87,7 +87,7 @@ def test_change_link_with_counter(self):

presenter = ImplantedMedicalDeviceHistoryItemPresenter(item, counter=2)
assert presenter.change_link == {
"href": f"/mammograms/{item.appointment_id}/record-medical-information/implanted-medical-device-history/{item.pk}",
"href": f"/mammograms/{item.appointment_id}/record-medical-information/implanted-medical-device-history/{item.pk}/",
"text": "Change",
"visually_hidden_text": " item 2",
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from manage_breast_screening.mammograms.presenters.mastectomy_or_lumpectomy_history_item_presenter import (
from manage_breast_screening.mammograms.presenters.medical_history.mastectomy_or_lumpectomy_history_item_presenter import (
MastectomyOrLumpectomyHistoryItemPresenter,
)
from manage_breast_screening.participants.models.medical_history.mastectomy_or_lumpectomy_history_item import (
Expand Down Expand Up @@ -87,7 +87,7 @@ def test_change_link(self):

presenter = MastectomyOrLumpectomyHistoryItemPresenter(item)
assert presenter.change_link == {
"href": f"/mammograms/{item.appointment_id}/record-medical-information/mastectomy-or-lumpectomy-history/{item.pk}",
"href": f"/mammograms/{item.appointment_id}/record-medical-information/mastectomy-or-lumpectomy-history/{item.pk}/",
"text": "Change",
"visually_hidden_text": " mastectomy or lumpectomy item",
}
Expand All @@ -99,7 +99,7 @@ def test_change_link_with_counter(self):

presenter = MastectomyOrLumpectomyHistoryItemPresenter(item, counter=2)
assert presenter.change_link == {
"href": f"/mammograms/{item.appointment_id}/record-medical-information/mastectomy-or-lumpectomy-history/{item.pk}",
"href": f"/mammograms/{item.appointment_id}/record-medical-information/mastectomy-or-lumpectomy-history/{item.pk}/",
"text": "Change",
"visually_hidden_text": " mastectomy or lumpectomy item 2",
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from manage_breast_screening.mammograms.presenters.other_procedure_history_item_presenter import (
from manage_breast_screening.mammograms.presenters.medical_history.other_procedure_history_item_presenter import (
OtherProcedureHistoryItemPresenter,
)
from manage_breast_screening.participants.models.medical_history.other_procedure_history_item import (
Expand Down
Loading