Skip to content

Commit 8c756aa

Browse files
Merge pull request #863 from NHSDigital/DTOSS-11867-clinic-show-snagging-updates
Clinic show page snagging updates
2 parents 7df2a4f + a9b1b31 commit 8c756aa

File tree

4 files changed

+33
-18
lines changed

4 files changed

+33
-18
lines changed

manage_breast_screening/clinics/jinja2/clinics/show.jinja

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
{% block beforeContent %}
1313
{{ backLink({
1414
"href": url('clinics:index'),
15+
"text": "Clinics"
1516
}) }}
1617
{% endblock beforeContent %}
1718

@@ -49,7 +50,7 @@
4950
<p class="nhsuk-u-margin-bottom-1 nhsuk-u-font-weight-bold">
5051
{{ presented_appointment.participant.full_name }}
5152
</p>
52-
<p class="nhsuk-u-secondary-text-color nhsuk-u-margin-bottom-0">
53+
<p class="nhsuk-u-secondary-text-colour">
5354
NHS: {{ presented_appointment.participant.nhs_number }}
5455
</p>
5556
{% endset %}
@@ -69,7 +70,7 @@
6970
app_appointment_status(presented_appointment)
7071
}}
7172
{% if presented_appointment.status_attribution %}
72-
<span class="app-text-grey app-nowrap nhsuk-body-s nhsuk-u-margin-bottom-0">{{ presented_appointment.status_attribution }}</span>
73+
<p class="nhsuk-u-secondary-text-colour">{{ presented_appointment.status_attribution }} {{presented_appointment.attribution_user_check(request.user)}}</p>
7374
{% endif %}
7475
<p class="nhsuk-u-margin-top-2 nhsuk-u-margin-bottom-0 app-u-nowrap">
7576
<a href="{{ url('mammograms:show_appointment', kwargs={"pk": presented_appointment.pk}) }}" class="nhsuk-link">

manage_breast_screening/mammograms/presenters/appointment_presenters.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,12 @@ def status_attribution(self):
117117
else:
118118
return None
119119

120+
def attribution_user_check(self, user):
121+
if user.pk == self._appointment.current_status.created_by.pk:
122+
return " (you)"
123+
else:
124+
return ""
125+
120126
@cached_property
121127
def note(self):
122128
try:

manage_breast_screening/tests/system/clinical/test_clinic_show_page.py

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,11 @@ def test_accessibility(self):
6666
def test_status_attribution_display(self):
6767
self.given_i_am_logged_in_as_a_clinical_user()
6868
self.and_a_clinic_exists_that_is_run_by_my_provider()
69+
self.and_i_have_an_appointment_in_progress()
6970
self.and_there_are_appointments_in_various_statuses_with_attributed_users()
7071
self.and_i_am_on_the_clinic_show_page()
7172
self.when_i_click_on_all()
72-
self.then_i_can_see_status_attribution_for_relevant_appointments()
73+
self.then_i_can_see_status_attribution_for_these_appointments()
7374

7475
def and_a_clinic_exists_that_is_run_by_my_provider(self):
7576
user_assignment = self.current_user.assignments.first()
@@ -266,7 +267,6 @@ def then_i_can_see_the_special_appointment_banner(self):
266267

267268
def and_there_are_appointments_in_various_statuses_with_attributed_users(self):
268269
# Create users for attribution
269-
user_in_progress = UserFactory(first_name="Alice", last_name="User")
270270
user_screened = UserFactory(first_name="Bob", last_name="User")
271271
user_cancelled = UserFactory(first_name="Charlie", last_name="User")
272272

@@ -278,17 +278,6 @@ def and_there_are_appointments_in_various_statuses_with_attributed_users(self):
278278
last_name="Confirmed",
279279
)
280280

281-
# STARTED status
282-
self.in_progress_appointment = AppointmentFactory(
283-
clinic_slot__clinic=self.clinic,
284-
first_name="Participant",
285-
last_name="InProgress",
286-
)
287-
self.in_progress_appointment.statuses.create(
288-
name=AppointmentStatus.STARTED,
289-
created_by=user_in_progress,
290-
)
291-
292281
# SCREENED status
293282
self.screened_appointment = AppointmentFactory(
294283
clinic_slot__clinic=self.clinic,
@@ -311,7 +300,7 @@ def and_there_are_appointments_in_various_statuses_with_attributed_users(self):
311300
created_by=user_cancelled,
312301
)
313302

314-
def then_i_can_see_status_attribution_for_relevant_appointments(self):
303+
def then_i_can_see_status_attribution_for_these_appointments(self):
315304
confirmed_row = self.page.locator("tr").filter(has_text="Participant Confirmed")
316305

317306
expect(confirmed_row).not_to_contain_text("with")
@@ -320,10 +309,26 @@ def then_i_can_see_status_attribution_for_relevant_appointments(self):
320309
in_progress_row = self.page.locator("tr").filter(
321310
has_text="Participant InProgress"
322311
)
323-
expect(in_progress_row).to_contain_text("with A. User")
312+
313+
expect(in_progress_row).to_contain_text(
314+
f"with {self.current_user.get_short_name()} (you)"
315+
)
324316

325317
screened_row = self.page.locator("tr").filter(has_text="Participant Screened")
326318
expect(screened_row).to_contain_text("by B. User")
319+
expect(screened_row).not_to_contain_text("(you)")
327320

328321
cancelled_row = self.page.locator("tr").filter(has_text="Participant Cancelled")
329322
expect(cancelled_row).to_contain_text("by C. User")
323+
expect(cancelled_row).not_to_contain_text("(you)")
324+
325+
def and_i_have_an_appointment_in_progress(self):
326+
self.in_progress_appointment = AppointmentFactory(
327+
clinic_slot__clinic=self.clinic,
328+
first_name="Participant",
329+
last_name="InProgress",
330+
)
331+
self.in_progress_appointment.statuses.create(
332+
name=AppointmentStatus.STARTED,
333+
created_by=self.current_user,
334+
)

manage_breast_screening/tests/system/system_test_setup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ def login_as_user(self, user: User):
4646
Emulate logging in as a particular user, without needing
4747
to visit a login page.
4848
"""
49+
50+
self.current_user = user
51+
4952
# Fake a login
5053
client = Client()
5154
client.force_login(user)
@@ -75,9 +78,9 @@ def login_as_role(self, role: Role):
7578
without needing to visit a login page.
7679
"""
7780
user = UserFactory.create()
81+
7882
UserAssignmentFactory.create(user=user, roles=[role.value])
7983

80-
self.current_user = user
8184
self.current_provider = user.assignments.first().provider
8285
self.login_as_user(user)
8386

0 commit comments

Comments
 (0)