diff --git a/manage_breast_screening/clinics/jinja2/clinics/show.jinja b/manage_breast_screening/clinics/jinja2/clinics/show.jinja
index ac13afdd1..9b92449ae 100644
--- a/manage_breast_screening/clinics/jinja2/clinics/show.jinja
+++ b/manage_breast_screening/clinics/jinja2/clinics/show.jinja
@@ -12,7 +12,7 @@
{% block beforeContent %}
{{ backLink({
"href": url('clinics:index'),
- "text": "Go back"
+ "text": "Clinics"
}) }}
{% endblock beforeContent %}
@@ -50,7 +50,7 @@
{{ presented_appointment.participant.full_name }}
-
+
NHS: {{ presented_appointment.participant.nhs_number }}
{% endset %}
@@ -70,7 +70,7 @@
app_appointment_status(presented_appointment)
}}
{% if presented_appointment.status_attribution %}
- {{ presented_appointment.status_attribution }}
+ {{ presented_appointment.status_attribution }} {{presented_appointment.attribution_user_check(request.user)}}
{% endif %}
diff --git a/manage_breast_screening/mammograms/presenters/appointment_presenters.py b/manage_breast_screening/mammograms/presenters/appointment_presenters.py
index 38dcba402..09c5078bd 100644
--- a/manage_breast_screening/mammograms/presenters/appointment_presenters.py
+++ b/manage_breast_screening/mammograms/presenters/appointment_presenters.py
@@ -117,6 +117,12 @@ def status_attribution(self):
else:
return None
+ def attribution_user_check(self, user):
+ if user.pk == self._appointment.current_status.created_by.pk:
+ return " (you)"
+ else:
+ return ""
+
@cached_property
def note(self):
try:
diff --git a/manage_breast_screening/tests/system/clinical/test_clinic_show_page.py b/manage_breast_screening/tests/system/clinical/test_clinic_show_page.py
index b05c03daf..79e08497c 100644
--- a/manage_breast_screening/tests/system/clinical/test_clinic_show_page.py
+++ b/manage_breast_screening/tests/system/clinical/test_clinic_show_page.py
@@ -6,6 +6,7 @@
from django.urls import reverse
from playwright.sync_api import expect
+from manage_breast_screening.auth.models import Role
from manage_breast_screening.clinics.models import Clinic
from manage_breast_screening.clinics.tests.factories import ClinicFactory
from manage_breast_screening.core.utils.date_formatting import format_date, format_time
@@ -64,12 +65,13 @@ def test_accessibility(self):
self.then_the_accessibility_baseline_is_met()
def test_status_attribution_display(self):
- self.given_i_am_logged_in_as_a_clinical_user()
+ self.given_i_am_logged_in_as_a_user_with_appointment_in_progress()
self.and_a_clinic_exists_that_is_run_by_my_provider()
self.and_there_are_appointments_in_various_statuses_with_attributed_users()
self.and_i_am_on_the_clinic_show_page()
self.when_i_click_on_all()
self.then_i_can_see_status_attribution_for_relevant_appointments()
+ self.then_i_can_see_you_in_status_attribution()
def and_a_clinic_exists_that_is_run_by_my_provider(self):
user_assignment = self.current_user.assignments.first()
@@ -266,7 +268,6 @@ def then_i_can_see_the_special_appointment_banner(self):
def and_there_are_appointments_in_various_statuses_with_attributed_users(self):
# Create users for attribution
- user_in_progress = UserFactory(first_name="Alice", last_name="User")
user_screened = UserFactory(first_name="Bob", last_name="User")
user_cancelled = UserFactory(first_name="Charlie", last_name="User")
@@ -286,7 +287,7 @@ def and_there_are_appointments_in_various_statuses_with_attributed_users(self):
)
self.in_progress_appointment.statuses.create(
name=AppointmentStatus.STARTED,
- created_by=user_in_progress,
+ created_by=self.user_in_progress,
)
# SCREENED status
@@ -320,10 +321,24 @@ def then_i_can_see_status_attribution_for_relevant_appointments(self):
in_progress_row = self.page.locator("tr").filter(
has_text="Participant InProgress"
)
- expect(in_progress_row).to_contain_text("with A. User")
+ expect(in_progress_row).to_contain_text("with A. InProgress (you)")
screened_row = self.page.locator("tr").filter(has_text="Participant Screened")
expect(screened_row).to_contain_text("by B. User")
cancelled_row = self.page.locator("tr").filter(has_text="Participant Cancelled")
expect(cancelled_row).to_contain_text("by C. User")
+
+ def given_i_am_logged_in_as_a_user_with_appointment_in_progress(self):
+ # Create and log in the user who will be attributed with the IN_PROGRESS status
+ self.user_in_progress = self.create_user_with_role(
+ first_name="Alice", last_name="InProgress", role=Role.CLINICAL
+ )
+ self.login_as_user(self.user_in_progress)
+
+ def then_i_can_see_you_in_status_attribution(self):
+ # Check that the "(you)" indicator is present for the in-progress attribution
+ in_progress_row = self.page.locator("tr").filter(
+ has_text="Participant InProgress"
+ )
+ expect(in_progress_row).to_contain_text("(you)")
diff --git a/manage_breast_screening/tests/system/system_test_setup.py b/manage_breast_screening/tests/system/system_test_setup.py
index 9d316e9b9..7439b4d75 100644
--- a/manage_breast_screening/tests/system/system_test_setup.py
+++ b/manage_breast_screening/tests/system/system_test_setup.py
@@ -46,6 +46,9 @@ def login_as_user(self, user: User):
Emulate logging in as a particular user, without needing
to visit a login page.
"""
+
+ self.current_user = user
+
# Fake a login
client = Client()
client.force_login(user)
@@ -75,12 +78,19 @@ def login_as_role(self, role: Role):
without needing to visit a login page.
"""
user = UserFactory.create()
+
UserAssignmentFactory.create(user=user, roles=[role.value])
- self.current_user = user
self.current_provider = user.assignments.first().provider
self.login_as_user(user)
+ def create_user_with_role(
+ self, first_name: str, last_name: str, role: Role
+ ) -> User:
+ user = UserFactory.create(first_name=first_name, last_name=last_name)
+ UserAssignmentFactory.create(user=user, roles=[role.value])
+ return user
+
def expect_validation_error(
self,
error_text: str,