diff --git a/manage_breast_screening/clinics/views.py b/manage_breast_screening/clinics/views.py index 1b8eb734f..0397a6b9a 100644 --- a/manage_breast_screening/clinics/views.py +++ b/manage_breast_screening/clinics/views.py @@ -58,7 +58,7 @@ def check_in(request, pk, appointment_pk): appointment = provider.appointments.get(pk=appointment_pk) except Appointment.DoesNotExist: raise Http404("Appointment not found") - appointment.statuses.create(state=AppointmentStatus.CHECKED_IN) + appointment.statuses.create(name=AppointmentStatus.CHECKED_IN) return redirect("clinics:show", pk=pk) diff --git a/manage_breast_screening/data/west_tester_today_clinic_data.yml b/manage_breast_screening/data/west_tester_today_clinic_data.yml index dd545f19d..d81c2902e 100644 --- a/manage_breast_screening/data/west_tester_today_clinic_data.yml +++ b/manage_breast_screening/data/west_tester_today_clinic_data.yml @@ -40,6 +40,7 @@ clinic: statuses: - CONFIRMED - CHECKED_IN + - STARTED screening_episode: id: b33ce2c9-6b96-4975-9439-3beb60333d4e participant: @@ -73,6 +74,8 @@ clinic: statuses: - CONFIRMED - CHECKED_IN + - STARTED + - IDENTITY_CONFIRMED screening_episode: id: 9bbdccba-ce84-4cc6-b980-da147c0d6d15 participant: @@ -107,6 +110,9 @@ clinic: statuses: - CONFIRMED - CHECKED_IN + - STARTED + - IDENTITY_CONFIRMED + - MEDICAL_INFORMATION_REVIEWED screening_episode: id: 3b6b2da9-9dda-415d-89d7-f4c5b5ec029a participant: @@ -141,6 +147,10 @@ clinic: statuses: - CONFIRMED - CHECKED_IN + - STARTED + - IDENTITY_CONFIRMED + - MEDICAL_INFORMATION_REVIEWED + - IMAGES_TAKEN screening_episode: id: 0314777f-907c-4372-a137-e067f15a7662 participant: @@ -696,7 +706,7 @@ clinic: appointment: id: 0a382d89-0042-49b8-87ba-fa0d9c817fd3 statuses: - - IN_PROGRESS + - STARTED screening_episode: id: 1ddfad46-b4de-47b9-b2ce-50a76e2d1a57 participant: diff --git a/manage_breast_screening/mammograms/forms/appointment_cannot_go_ahead_form.py b/manage_breast_screening/mammograms/forms/appointment_cannot_go_ahead_form.py index 722c04ef7..ce20dcc70 100644 --- a/manage_breast_screening/mammograms/forms/appointment_cannot_go_ahead_form.py +++ b/manage_breast_screening/mammograms/forms/appointment_cannot_go_ahead_form.py @@ -88,6 +88,6 @@ def save(self): self.instance.stopped_reasons = reasons_json self.instance.reinvite = self.cleaned_data["decision"] self.instance.save() - self.instance.statuses.create(state=AppointmentStatus.ATTENDED_NOT_SCREENED) + self.instance.statuses.create(name=AppointmentStatus.ATTENDED_NOT_SCREENED) return self.instance diff --git a/manage_breast_screening/mammograms/presenters/appointment_presenters.py b/manage_breast_screening/mammograms/presenters/appointment_presenters.py index 36f4d7149..38dcba402 100644 --- a/manage_breast_screening/mammograms/presenters/appointment_presenters.py +++ b/manage_breast_screening/mammograms/presenters/appointment_presenters.py @@ -68,7 +68,7 @@ def can_be_made_special(self): @cached_property def can_be_checked_in(self): - return self._appointment.current_status.state == AppointmentStatus.CONFIRMED + return self._appointment.current_status.name == AppointmentStatus.CONFIRMED @cached_property def active(self): @@ -89,17 +89,21 @@ def special_appointment_tag_properties(self): @cached_property def current_status(self): current_status = self._appointment.current_status - - colour = status_colour(current_status.state) + colour = status_colour(current_status) + display_text = ( + "In progress" + if current_status.is_in_progress() + else current_status.get_name_display() + ) return { "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, - "is_screened": current_status.state == AppointmentStatus.SCREENED, + "text": display_text, + "key": current_status.name, + "is_confirmed": current_status.name == AppointmentStatus.CONFIRMED, + "is_screened": current_status.name == AppointmentStatus.SCREENED, } @cached_property @@ -108,7 +112,7 @@ def status_attribution(self): return ( "with " + self._appointment.current_status.created_by.get_short_name() ) - elif self._appointment.current_status.is_final_state(): + elif self._appointment.current_status.is_final_status(): return "by " + self._appointment.current_status.created_by.get_short_name() else: return None @@ -135,7 +139,7 @@ def show_status_bar_for(self, user): # The appointment status bar should only display if the current user is the one that has the appointment 'in progress' current_status = self.appointment._appointment.current_status return ( - current_status.state == AppointmentStatus.IN_PROGRESS + current_status.is_in_progress() and user.nhs_uid == current_status.created_by.nhs_uid ) diff --git a/manage_breast_screening/mammograms/services/appointment_services.py b/manage_breast_screening/mammograms/services/appointment_services.py index a894c85e1..7108de23f 100644 --- a/manage_breast_screening/mammograms/services/appointment_services.py +++ b/manage_breast_screening/mammograms/services/appointment_services.py @@ -12,9 +12,9 @@ class ActionNotPermitted(Exception): """ -class InvalidState(Exception): +class InvalidStatus(Exception): """ - The appointment is not in a valid state to perform the action. + The appointment is not in a valid status to perform the action. """ @@ -26,8 +26,7 @@ class ActionPerformedByDifferentUser(Exception): class AppointmentStatusUpdater: """ - Transition an appointment to another state. - Each state is logged in AppointmentStatusHistory and associated with a user. + Transition an appointment to another status. """ def __init__(self, appointment, current_user): @@ -36,13 +35,13 @@ def __init__(self, appointment, current_user): def check_in(self): return self._transition( - to_state=AppointmentStatus.CHECKED_IN, - from_states=(AppointmentStatus.CONFIRMED,), + to_status=AppointmentStatus.CHECKED_IN, + from_statuses=(AppointmentStatus.CONFIRMED,), ) @staticmethod def is_startable(appointment): - return appointment is not None and appointment.current_status.state in ( + return appointment is not None and appointment.current_status.name in ( AppointmentStatus.CONFIRMED, AppointmentStatus.CHECKED_IN, ) @@ -54,46 +53,46 @@ def start(self): raise ActionNotPermitted(self.appointment.current_status) return self._transition( - to_state=AppointmentStatus.IN_PROGRESS, - from_states=(AppointmentStatus.CONFIRMED, AppointmentStatus.CHECKED_IN), + to_status=AppointmentStatus.STARTED, + from_statuses=(AppointmentStatus.CONFIRMED, AppointmentStatus.CHECKED_IN), ) def cancel(self): return self._transition( - to_state=AppointmentStatus.CANCELLED, - from_states=(AppointmentStatus.CONFIRMED,), + to_status=AppointmentStatus.CANCELLED, + from_statuses=(AppointmentStatus.CONFIRMED,), ) def mark_did_not_attend(self): return self._transition( - to_state=AppointmentStatus.DID_NOT_ATTEND, - from_states=(AppointmentStatus.CONFIRMED,), + to_status=AppointmentStatus.DID_NOT_ATTEND, + from_statuses=(AppointmentStatus.CONFIRMED,), ) def screen(self, partial=False): return self._transition( - to_state=( + to_status=( AppointmentStatus.PARTIALLY_SCREENED if partial else AppointmentStatus.SCREENED ), - from_states=(AppointmentStatus.IN_PROGRESS,), + from_statuses=(AppointmentStatus.STARTED,), ) - def _transition(self, to_state, from_states): - current_state = self.appointment.current_status.state - if current_state != to_state and current_state not in from_states: - raise InvalidState(self.appointment.current_status) + def _transition(self, to_status, from_statuses): + current_status = self.appointment.current_status.name + if current_status != to_status and current_status not in from_statuses: + raise InvalidStatus(self.appointment.current_status) - return self._get_or_create(state=to_state) + return self._get_or_create(status=to_status) - def _get_or_create(self, state): + def _get_or_create(self, status): """ Make operations idempotent, providing that we're not changing the created_by user. """ new_status, created = self.appointment.statuses.get_or_create( - state=state, + name=status, defaults=dict(created_by=self.current_user), ) diff --git a/manage_breast_screening/mammograms/tests/presenters/test_appointment_presenters.py b/manage_breast_screening/mammograms/tests/presenters/test_appointment_presenters.py index 43b9d21b2..b9daa3ee1 100644 --- a/manage_breast_screening/mammograms/tests/presenters/test_appointment_presenters.py +++ b/manage_breast_screening/mammograms/tests/presenters/test_appointment_presenters.py @@ -14,6 +14,9 @@ SpecialAppointmentPresenter, ) from manage_breast_screening.participants.models import Appointment, AppointmentStatus +from manage_breast_screening.participants.tests.factories import ( + AppointmentStatusFactory, +) from manage_breast_screening.users.models import User @@ -76,7 +79,7 @@ def test_status( expected_is_confirmed, expected_is_screened, ): - mock_appointment.current_status = AppointmentStatus(state=status) + mock_appointment.current_status = AppointmentStatus(name=status) result = AppointmentPresenter(mock_appointment).current_status @@ -108,19 +111,19 @@ def test_can_be_made_special( ) @pytest.mark.parametrize( - "has_permission, state, result", + "has_permission, status_name, result", [ (True, AppointmentStatus.CONFIRMED, True), (True, AppointmentStatus.CHECKED_IN, True), (False, AppointmentStatus.CONFIRMED, False), - (True, AppointmentStatus.IN_PROGRESS, False), + (True, AppointmentStatus.STARTED, False), ], ) def test_can_be_started_by( - self, mock_appointment, mock_user, has_permission, state, result + self, mock_appointment, mock_user, has_permission, status_name, result ): mock_user.has_perm.return_value = has_permission - mock_appointment.current_status.state = state + mock_appointment.current_status.name = status_name assert ( AppointmentPresenter(mock_appointment).can_be_started_by(mock_user) @@ -180,8 +183,126 @@ def test_is_special_appointment( presenter = AppointmentPresenter(mock_appointment) assert presenter.is_special_appointment == expected_result + class TestCurrentStatus: + @pytest.mark.parametrize( + "status_name, expected_classes, expected_text, expected_key, is_confirmed, is_screened", + [ + ( + AppointmentStatus.CHECKED_IN, + "app-u-nowrap", + "Checked in", + "CHECKED_IN", + False, + False, + ), + ( + AppointmentStatus.CONFIRMED, + "nhsuk-tag--blue app-u-nowrap", + "Confirmed", + "CONFIRMED", + True, + False, + ), + ( + AppointmentStatus.STARTED, + "nhsuk-tag--aqua-green app-u-nowrap", + "In progress", + "STARTED", + False, + False, + ), + ( + AppointmentStatus.IDENTITY_CONFIRMED, + "nhsuk-tag--aqua-green app-u-nowrap", + "In progress", + "IDENTITY_CONFIRMED", + False, + False, + ), + ( + AppointmentStatus.MEDICAL_INFORMATION_REVIEWED, + "nhsuk-tag--aqua-green app-u-nowrap", + "In progress", + "MEDICAL_INFORMATION_REVIEWED", + False, + False, + ), + ( + AppointmentStatus.IMAGES_TAKEN, + "nhsuk-tag--aqua-green app-u-nowrap", + "In progress", + "IMAGES_TAKEN", + False, + False, + ), + ( + AppointmentStatus.CANCELLED, + "nhsuk-tag--red app-u-nowrap", + "Cancelled", + "CANCELLED", + False, + False, + ), + ( + AppointmentStatus.DID_NOT_ATTEND, + "nhsuk-tag--red app-u-nowrap", + "Did not attend", + "DID_NOT_ATTEND", + False, + False, + ), + ( + AppointmentStatus.SCREENED, + "nhsuk-tag--green app-u-nowrap", + "Screened", + "SCREENED", + False, + True, + ), + ( + AppointmentStatus.PARTIALLY_SCREENED, + "nhsuk-tag--orange app-u-nowrap", + "Partially screened", + "PARTIALLY_SCREENED", + False, + False, + ), + ( + AppointmentStatus.ATTENDED_NOT_SCREENED, + "nhsuk-tag--orange app-u-nowrap", + "Attended not screened", + "ATTENDED_NOT_SCREENED", + False, + False, + ), + ], + ) + def test_current_status_properties( + self, + mock_appointment, + status_name, + expected_classes, + expected_text, + expected_key, + is_confirmed, + is_screened, + ): + mock_appointment.current_status = AppointmentStatusFactory.build( + name=status_name + ) + presenter = AppointmentPresenter(mock_appointment) + + expected = { + "classes": expected_classes, + "text": expected_text, + "key": expected_key, + "is_confirmed": is_confirmed, + "is_screened": is_screened, + } + assert presenter.current_status == expected + @pytest.mark.parametrize( - "is_in_progress, is_final_state, expected_result", + "is_in_progress, is_final_status, expected_result", [ (True, False, "with A. Tester"), (False, True, "by A. Tester"), @@ -189,13 +310,13 @@ def test_is_special_appointment( ], ) def test_status_attribution( - self, mock_appointment, is_in_progress, is_final_state, expected_result + self, mock_appointment, is_in_progress, is_final_status, expected_result ): mock_appointment.current_status.created_by.get_short_name.return_value = ( "A. Tester" ) mock_appointment.current_status.is_in_progress.return_value = is_in_progress - mock_appointment.current_status.is_final_state.return_value = is_final_state + mock_appointment.current_status.is_final_status.return_value = is_final_status presenter = AppointmentPresenter(mock_appointment) assert presenter.status_attribution == expected_result @@ -215,34 +336,25 @@ def mock_user(self): def test_show_status_bar_when_in_progress_and_user_is_owner( self, mock_appointment, mock_user ): - mock_appointment.current_status.state = AppointmentStatus.IN_PROGRESS + mock_appointment.current_status.is_in_progress.return_value = True mock_user.nhs_uid = "user-123" mock_appointment.current_status.created_by.nhs_uid = "user-123" presenter = AppointmentPresenter(mock_appointment) assert presenter.status_bar.show_status_bar_for(mock_user) - def test_show_status_bar_when_user_is_not_owner(self, mock_appointment, mock_user): - mock_appointment.current_status.state = AppointmentStatus.IN_PROGRESS + def test_dont_show_status_bar_when_user_is_not_owner( + self, mock_appointment, mock_user + ): + mock_appointment.current_status.is_in_progress.return_value = True mock_user.nhs_uid = "user-123" mock_appointment.current_status.created_by.nhs_uid = "user-456" presenter = AppointmentPresenter(mock_appointment) assert not presenter.status_bar.show_status_bar_for(mock_user) - @pytest.mark.parametrize( - "current_state", - [ - AppointmentStatus.CONFIRMED, - AppointmentStatus.CHECKED_IN, - AppointmentStatus.DID_NOT_ATTEND, - AppointmentStatus.SCREENED, - AppointmentStatus.PARTIALLY_SCREENED, - AppointmentStatus.ATTENDED_NOT_SCREENED, - ], - ) def test_dont_show_status_bar_when_not_in_progress( - self, mock_appointment, mock_user, current_state + self, mock_appointment, mock_user ): - mock_appointment.current_status.state = current_state + mock_appointment.current_status.is_in_progress.return_value = False mock_user.nhs_uid = "user-123" mock_appointment.current_status.created_by.nhs_uid = "user-123" presenter = AppointmentPresenter(mock_appointment) diff --git a/manage_breast_screening/mammograms/tests/services/test_appointment_services.py b/manage_breast_screening/mammograms/tests/services/test_appointment_services.py index 1570aa89d..0e65bfc1d 100644 --- a/manage_breast_screening/mammograms/tests/services/test_appointment_services.py +++ b/manage_breast_screening/mammograms/tests/services/test_appointment_services.py @@ -3,7 +3,7 @@ from manage_breast_screening.mammograms.services.appointment_services import ( ActionPerformedByDifferentUser, AppointmentStatusUpdater, - InvalidState, + InvalidStatus, ) from manage_breast_screening.participants.models.appointment import AppointmentStatus from manage_breast_screening.participants.tests.factories import ( @@ -22,7 +22,7 @@ def test_invalid_check_in(self, clinical_user): appointment=appointment, current_user=clinical_user ) - with pytest.raises(InvalidState): + with pytest.raises(InvalidStatus): service.check_in() def test_valid_check_in(self, clinical_user): @@ -34,7 +34,7 @@ def test_valid_check_in(self, clinical_user): ) new_status = service.check_in() - assert new_status.state == AppointmentStatus.CHECKED_IN + assert new_status.name == AppointmentStatus.CHECKED_IN def test_invalid_start(self, clinical_user): appointment = AppointmentFactory.create( @@ -44,7 +44,7 @@ def test_invalid_start(self, clinical_user): appointment=appointment, current_user=clinical_user ) - with pytest.raises(InvalidState): + with pytest.raises(InvalidStatus): service.start() @pytest.mark.parametrize( @@ -57,7 +57,7 @@ def test_valid_start(self, clinical_user, current_status): ) new_status = service.start() - assert new_status.state == AppointmentStatus.IN_PROGRESS + assert new_status.name == AppointmentStatus.STARTED def test_invalid_cancel(self, clinical_user): appointment = AppointmentFactory.create( @@ -67,7 +67,7 @@ def test_invalid_cancel(self, clinical_user): appointment=appointment, current_user=clinical_user ) - with pytest.raises(InvalidState): + with pytest.raises(InvalidStatus): service.cancel() def test_valid_cancel(self, clinical_user): @@ -79,7 +79,7 @@ def test_valid_cancel(self, clinical_user): ) new_status = service.cancel() - assert new_status.state == AppointmentStatus.CANCELLED + assert new_status.name == AppointmentStatus.CANCELLED def test_invalid_mark_did_not_attend(self, clinical_user): appointment = AppointmentFactory.create( @@ -89,7 +89,7 @@ def test_invalid_mark_did_not_attend(self, clinical_user): appointment=appointment, current_user=clinical_user ) - with pytest.raises(InvalidState): + with pytest.raises(InvalidStatus): service.mark_did_not_attend() def test_valid_mark_did_not_attend(self, clinical_user): @@ -101,7 +101,7 @@ def test_valid_mark_did_not_attend(self, clinical_user): ) new_status = service.mark_did_not_attend() - assert new_status.state == AppointmentStatus.DID_NOT_ATTEND + assert new_status.name == AppointmentStatus.DID_NOT_ATTEND def test_invalid_screen(self, clinical_user): appointment = AppointmentFactory.create( @@ -111,55 +111,55 @@ def test_invalid_screen(self, clinical_user): appointment=appointment, current_user=clinical_user ) - with pytest.raises(InvalidState): + with pytest.raises(InvalidStatus): service.screen() - with pytest.raises(InvalidState): + with pytest.raises(InvalidStatus): service.screen(partial=True) def test_valid_screen(self, clinical_user): appointment = AppointmentFactory.create( - current_status=AppointmentStatus.IN_PROGRESS + current_status=AppointmentStatus.STARTED ) service = AppointmentStatusUpdater( appointment=appointment, current_user=clinical_user ) new_status = service.screen() - assert new_status.state == AppointmentStatus.SCREENED + assert new_status.name == AppointmentStatus.SCREENED def test_valid_partial_screen(self, clinical_user): appointment = AppointmentFactory.create( - current_status=AppointmentStatus.IN_PROGRESS + current_status=AppointmentStatus.STARTED ) service = AppointmentStatusUpdater( appointment=appointment, current_user=clinical_user ) new_status = service.screen(partial=True) - assert new_status.state == AppointmentStatus.PARTIALLY_SCREENED + assert new_status.name == AppointmentStatus.PARTIALLY_SCREENED def test_check_in_is_idempotent(self, clinical_user): appointment = AppointmentFactory.create( current_status=AppointmentStatus.CONFIRMED ) AppointmentStatusFactory.create( - state=AppointmentStatus.CHECKED_IN, + name=AppointmentStatus.CHECKED_IN, created_by=clinical_user, appointment=appointment, ) - assert appointment.current_status.state == AppointmentStatus.CHECKED_IN + assert appointment.current_status.name == AppointmentStatus.CHECKED_IN service = AppointmentStatusUpdater( appointment=appointment, current_user=clinical_user ) new_status = service.check_in() - assert new_status.state == AppointmentStatus.CHECKED_IN + assert new_status.name == AppointmentStatus.CHECKED_IN def test_cannot_start_appointment_started_by_someone_else(self, clinical_user): appointment = AppointmentFactory.create( - current_status=AppointmentStatus.IN_PROGRESS + current_status=AppointmentStatus.STARTED ) service = AppointmentStatusUpdater( diff --git a/manage_breast_screening/mammograms/tests/test_rules.py b/manage_breast_screening/mammograms/tests/test_rules.py index 7efc77483..23a9ea0eb 100644 --- a/manage_breast_screening/mammograms/tests/test_rules.py +++ b/manage_breast_screening/mammograms/tests/test_rules.py @@ -48,7 +48,7 @@ def screened_appointment(self): @pytest.fixture def in_progress_appointment(self): - return AppointmentFactory.create(current_status=AppointmentStatus.IN_PROGRESS) + return AppointmentFactory.create(current_status=AppointmentStatus.STARTED) def test_can_start_if_user_is_clinical(self, clinical_user): assert clinical_user.has_perm(Permission.START_MAMMOGRAM_APPOINTMENT) diff --git a/manage_breast_screening/mammograms/tests/views/test_participant_reported_mammogram_views.py b/manage_breast_screening/mammograms/tests/views/test_participant_reported_mammogram_views.py index 7c54b0a75..d13afda44 100644 --- a/manage_breast_screening/mammograms/tests/views/test_participant_reported_mammogram_views.py +++ b/manage_breast_screening/mammograms/tests/views/test_participant_reported_mammogram_views.py @@ -184,7 +184,7 @@ def test_post_exact_date_within_last_six_months( ) + f"?return_url={return_url}", ) - assert appointment.current_status.state == AppointmentStatus.CONFIRMED + assert appointment.current_status.name == AppointmentStatus.CONFIRMED response = clinical_user_client.http.post( reverse( @@ -200,7 +200,7 @@ def test_post_exact_date_within_last_six_months( ), ) assert ( - appointment.current_status.state == AppointmentStatus.ATTENDED_NOT_SCREENED + appointment.current_status.name == AppointmentStatus.ATTENDED_NOT_SCREENED ) @@ -405,7 +405,7 @@ def test_post_exact_date_within_last_six_months( ) + f"?return_url={return_url}", ) - assert appointment.current_status.state == AppointmentStatus.CONFIRMED + assert appointment.current_status.name == AppointmentStatus.CONFIRMED response = clinical_user_client.http.post( reverse( @@ -421,5 +421,5 @@ def test_post_exact_date_within_last_six_months( ), ) assert ( - appointment.current_status.state == AppointmentStatus.ATTENDED_NOT_SCREENED + appointment.current_status.name == AppointmentStatus.ATTENDED_NOT_SCREENED ) diff --git a/manage_breast_screening/mammograms/views/mammogram_views.py b/manage_breast_screening/mammograms/views/mammogram_views.py index 68a3d44f0..214962833 100644 --- a/manage_breast_screening/mammograms/views/mammogram_views.py +++ b/manage_breast_screening/mammograms/views/mammogram_views.py @@ -76,6 +76,6 @@ def attended_not_screened(request, appointment_pk): appointment = provider.appointments.get(pk=appointment_pk) except Appointment.DoesNotExist: raise Http404("Appointment not found") - appointment.statuses.create(state=AppointmentStatus.ATTENDED_NOT_SCREENED) + appointment.statuses.create(name=AppointmentStatus.ATTENDED_NOT_SCREENED) return redirect("clinics:show", pk=appointment.clinic_slot.clinic.pk) diff --git a/manage_breast_screening/nonprod/management/commands/seed_demo_data.py b/manage_breast_screening/nonprod/management/commands/seed_demo_data.py index 3ecf529c6..5016dc5b7 100644 --- a/manage_breast_screening/nonprod/management/commands/seed_demo_data.py +++ b/manage_breast_screening/nonprod/management/commands/seed_demo_data.py @@ -169,7 +169,7 @@ def create_appointment(self, clinic_slot, appointment_key): for status_key in appointment_key.get("statuses", []): AppointmentStatusFactory( appointment=appointment, - state=status_key, + name=status_key, ) for symptom in appointment_key.get("symptoms", []): diff --git a/manage_breast_screening/participants/migrations/0051_rename_state_appointmentstatus_name_and_more.py b/manage_breast_screening/participants/migrations/0051_rename_state_appointmentstatus_name_and_more.py new file mode 100644 index 000000000..5118e0c35 --- /dev/null +++ b/manage_breast_screening/participants/migrations/0051_rename_state_appointmentstatus_name_and_more.py @@ -0,0 +1,22 @@ +# Generated by Django 5.2.8 on 2025-12-30 12:05 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('participants', '0050_medicalinformationreview'), + ] + + operations = [ + migrations.RenameField( + model_name='appointmentstatus', + old_name='state', + new_name='name', + ), + migrations.AlterUniqueTogether( + name='appointmentstatus', + unique_together={('appointment', 'name')}, + ), + ] diff --git a/manage_breast_screening/participants/migrations/0052_alter_appointmentstatus_name.py b/manage_breast_screening/participants/migrations/0052_alter_appointmentstatus_name.py new file mode 100644 index 000000000..810ff3ee3 --- /dev/null +++ b/manage_breast_screening/participants/migrations/0052_alter_appointmentstatus_name.py @@ -0,0 +1,18 @@ +# Generated by Django 5.2.8 on 2025-12-31 11:06 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('participants', '0051_rename_state_appointmentstatus_name_and_more'), + ] + + operations = [ + migrations.AlterField( + model_name='appointmentstatus', + name='name', + field=models.CharField(choices=[('CONFIRMED', 'Confirmed'), ('CHECKED_IN', 'Checked in'), ('STARTED', 'Started'), ('IDENTITY_CONFIRMED', 'Identity confirmed'), ('MEDICAL_INFORMATION_REVIEWED', 'Medical information reviewed'), ('IMAGES_TAKEN', 'Images taken'), ('CANCELLED', 'Cancelled'), ('DID_NOT_ATTEND', 'Did not attend'), ('SCREENED', 'Screened'), ('PARTIALLY_SCREENED', 'Partially screened'), ('ATTENDED_NOT_SCREENED', 'Attended not screened')], default='CONFIRMED', max_length=50), + ), + ] diff --git a/manage_breast_screening/participants/migrations/max_migration.txt b/manage_breast_screening/participants/migrations/max_migration.txt index 43876d5a7..55a29abde 100644 --- a/manage_breast_screening/participants/migrations/max_migration.txt +++ b/manage_breast_screening/participants/migrations/max_migration.txt @@ -1 +1 @@ -0050_medicalinformationreview +0052_alter_appointmentstatus_name diff --git a/manage_breast_screening/participants/models/appointment.py b/manage_breast_screening/participants/models/appointment.py index ef0b287c0..bde9e00f3 100644 --- a/manage_breast_screening/participants/models/appointment.py +++ b/manage_breast_screening/participants/models/appointment.py @@ -19,7 +19,7 @@ def in_status(self, *statuses): statuses=Subquery( AppointmentStatus.objects.filter( appointment=OuterRef("pk"), - state__in=statuses, + name__in=statuses, ) .values("pk") .order_by("-created_at")[:1] @@ -28,28 +28,21 @@ def in_status(self, *statuses): def remaining(self): return self.in_status( - AppointmentStatus.CONFIRMED, - AppointmentStatus.CHECKED_IN, - AppointmentStatus.IN_PROGRESS, + *AppointmentStatus.YET_TO_BEGIN_STATUSES, + *AppointmentStatus.IN_PROGRESS_STATUSES, ) def checked_in(self): return self.in_status(AppointmentStatus.CHECKED_IN) def in_progress(self): - return self.in_status(AppointmentStatus.IN_PROGRESS) + return self.in_status(*AppointmentStatus.IN_PROGRESS_STATUSES) def for_participant(self, participant_id): return self.filter(screening_episode__participant_id=participant_id) def complete(self): - return self.in_status( - AppointmentStatus.CANCELLED, - AppointmentStatus.DID_NOT_ATTEND, - AppointmentStatus.SCREENED, - AppointmentStatus.PARTIALLY_SCREENED, - AppointmentStatus.ATTENDED_NOT_SCREENED, - ) + return self.in_status(*AppointmentStatus.FINAL_STATUSES) def upcoming(self): return self.filter(clinic_slot__starts_at__date__gte=date.today()) @@ -130,7 +123,7 @@ def current_status(self) -> "AppointmentStatus": if not statuses: status = AppointmentStatus() logger.info( - f"Appointment {self.pk} has no statuses. Assuming {status.state}" + f"Appointment {self.pk} has no statuses. Assuming {status.name}" ) return status @@ -144,7 +137,10 @@ def active(self): class AppointmentStatus(models.Model): CONFIRMED = "CONFIRMED" CHECKED_IN = "CHECKED_IN" - IN_PROGRESS = "IN_PROGRESS" + STARTED = "STARTED" + IDENTITY_CONFIRMED = "IDENTITY_CONFIRMED" + MEDICAL_INFORMATION_REVIEWED = "MEDICAL_INFORMATION_REVIEWED" + IMAGES_TAKEN = "IMAGES_TAKEN" CANCELLED = "CANCELLED" DID_NOT_ATTEND = "DID_NOT_ATTEND" SCREENED = "SCREENED" @@ -154,14 +150,38 @@ class AppointmentStatus(models.Model): STATUS_CHOICES = { CONFIRMED: "Confirmed", CHECKED_IN: "Checked in", - IN_PROGRESS: "In progress", + STARTED: "Started", + IDENTITY_CONFIRMED: "Identity confirmed", + MEDICAL_INFORMATION_REVIEWED: "Medical information reviewed", + IMAGES_TAKEN: "Images taken", CANCELLED: "Cancelled", DID_NOT_ATTEND: "Did not attend", SCREENED: "Screened", PARTIALLY_SCREENED: "Partially screened", ATTENDED_NOT_SCREENED: "Attended not screened", } - state = models.CharField(choices=STATUS_CHOICES, max_length=50, default=CONFIRMED) + + YET_TO_BEGIN_STATUSES = [ + CONFIRMED, + CHECKED_IN, + ] + + IN_PROGRESS_STATUSES = [ + STARTED, + IDENTITY_CONFIRMED, + MEDICAL_INFORMATION_REVIEWED, + IMAGES_TAKEN, + ] + + FINAL_STATUSES = [ + CANCELLED, + DID_NOT_ATTEND, + SCREENED, + PARTIALLY_SCREENED, + ATTENDED_NOT_SCREENED, + ] + + name = models.CharField(choices=STATUS_CHOICES, max_length=50, default=CONFIRMED) id = models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True) created_at = models.DateTimeField(auto_now_add=True) @@ -173,31 +193,28 @@ class AppointmentStatus(models.Model): class Meta: ordering = ["-created_at"] - # Note: this is only valid as long as we can't undo a state transition. + # Note: this is only valid as long as we can't undo a status transition. # https://nhsd-jira.digital.nhs.uk/browse/DTOSS-11522 - unique_together = ("appointment", "state") + unique_together = ("appointment", "name") @property def active(self): """ - Is this state one of the active, non-final states? + Is this status one of the active, non-final statuses? """ - return self.state in [self.CONFIRMED, self.CHECKED_IN, self.IN_PROGRESS] + return self.is_in_progress() or self.is_yet_to_begin() - def is_final_state(self): - return self.state in [ - self.CANCELLED, - self.DID_NOT_ATTEND, - self.SCREENED, - self.PARTIALLY_SCREENED, - self.ATTENDED_NOT_SCREENED, - ] + def is_yet_to_begin(self): + return self.name in self.YET_TO_BEGIN_STATUSES def is_in_progress(self): - return self.state == self.IN_PROGRESS + return self.name in self.IN_PROGRESS_STATUSES + + def is_final_status(self): + return self.name in self.FINAL_STATUSES def __str__(self): - return self.state + return self.name class AppointmentNote(BaseModel): diff --git a/manage_breast_screening/participants/presenters.py b/manage_breast_screening/participants/presenters.py index 1d7a48a57..984e8771e 100644 --- a/manage_breast_screening/participants/presenters.py +++ b/manage_breast_screening/participants/presenters.py @@ -18,11 +18,11 @@ def status_colour(status): """ Color to render the status tag """ - match status: + if status.is_in_progress(): + return "aqua-green" + match status.name: case AppointmentStatus.CHECKED_IN: return "" # no colour will get solid dark blue - case AppointmentStatus.IN_PROGRESS: - return "aqua-green" case AppointmentStatus.SCREENED: return "green" case AppointmentStatus.DID_NOT_ATTEND | AppointmentStatus.CANCELLED: @@ -155,12 +155,12 @@ def _present_appointment(self, appointment): def _present_status(self, appointment): current_status = appointment.current_status - colour = status_colour(current_status.state) + colour = status_colour(current_status) return { "classes": ( f"nhsuk-tag--{colour} app-u-nowrap" if colour else "app-u-nowrap" ), - "text": current_status.get_state_display(), - "key": current_status.state, + "text": current_status.get_name_display(), + "key": current_status.name, } diff --git a/manage_breast_screening/participants/tests/factories.py b/manage_breast_screening/participants/tests/factories.py index 423091e69..92cb25bac 100644 --- a/manage_breast_screening/participants/tests/factories.py +++ b/manage_breast_screening/participants/tests/factories.py @@ -158,11 +158,11 @@ def current_status(obj, create, extracted, **kwargs): return obj.statuses.add( - AppointmentStatusFactory.create(state=extracted, appointment=obj) + AppointmentStatusFactory.create(name=extracted, appointment=obj) ) # Allow passing an explicit status and created_by user - # e.g. `current_status_params={'state': AppointmentStatus.IN_PROGRESS, 'created_by': self.current_user}` + # e.g. `current_status_params={'name': AppointmentStatus.STARTED, 'created_by': self.current_user}` @post_generation def current_status_params(obj, create, extracted, **kwargs): if not create or not extracted: diff --git a/manage_breast_screening/participants/tests/test_models.py b/manage_breast_screening/participants/tests/test_models.py index 8f1c6e04f..c61421df1 100644 --- a/manage_breast_screening/participants/tests/test_models.py +++ b/manage_breast_screening/participants/tests/test_models.py @@ -79,7 +79,7 @@ def test_previous_screening_episode(self): @pytest.mark.django_db class TestAppointment: - def test_state_filtering(self): + def test_status_filtering(self): confirmed = AppointmentFactory.create( current_status=models.AppointmentStatus.CONFIRMED ) @@ -264,19 +264,19 @@ def test_eager_loads_most_recent_status_with_created_by( latest_status = AppointmentStatusFactory.create( appointment=appointment, - state=models.AppointmentStatus.IN_PROGRESS, + name=models.AppointmentStatus.STARTED, created_at=datetime(2025, 1, 1, 10, tzinfo=tz.utc), ) AppointmentStatusFactory.create( appointment=appointment, - state=models.AppointmentStatus.CHECKED_IN, + name=models.AppointmentStatus.CHECKED_IN, created_at=datetime(2025, 1, 1, 9, tzinfo=tz.utc), ) AppointmentStatusFactory.create( appointment=appointment, - state=models.AppointmentStatus.CONFIRMED, + name=models.AppointmentStatus.CONFIRMED, created_at=datetime(2025, 1, 1, 8, tzinfo=tz.utc), ) @@ -301,12 +301,12 @@ def test_returns_prefetched_current_status_if_available( appointment = AppointmentFactory.create() latest_status = AppointmentStatusFactory.create( appointment=appointment, - state=models.AppointmentStatus.IN_PROGRESS, + name=models.AppointmentStatus.STARTED, created_at=datetime(2025, 1, 1, 9, tzinfo=tz.utc), ) AppointmentStatusFactory.create( appointment=appointment, - state=models.AppointmentStatus.CHECKED_IN, + name=models.AppointmentStatus.CHECKED_IN, created_at=datetime(2025, 1, 1, 8, tzinfo=tz.utc), ) @@ -323,12 +323,12 @@ def test_returns_current_status_even_if_not_prefetched( appointment = AppointmentFactory.create() latest_status = AppointmentStatusFactory.create( appointment=appointment, - state=models.AppointmentStatus.IN_PROGRESS, + name=models.AppointmentStatus.STARTED, created_at=datetime(2025, 1, 1, 9, tzinfo=tz.utc), ) AppointmentStatusFactory.create( appointment=appointment, - state=models.AppointmentStatus.CHECKED_IN, + name=models.AppointmentStatus.CHECKED_IN, created_at=datetime(2025, 1, 1, 8, tzinfo=tz.utc), ) @@ -339,23 +339,21 @@ def test_returns_current_status_even_if_not_prefetched( def test_returns_default_status_if_no_statuses(self, django_assert_num_queries): appointment = AppointmentFactory.create() - assert ( - appointment.current_status.state == models.AppointmentStatus.CONFIRMED - ) + assert appointment.current_status.name == models.AppointmentStatus.CONFIRMED class TestAppointmentStatus: class TestActive: - def test_active_states_return_true(self): - assert AppointmentStatus(state=AppointmentStatus.CONFIRMED).active - assert AppointmentStatus(state=AppointmentStatus.CHECKED_IN).active - assert AppointmentStatus(state=AppointmentStatus.IN_PROGRESS).active - assert not AppointmentStatus(state=AppointmentStatus.CANCELLED).active - assert not AppointmentStatus(state=AppointmentStatus.DID_NOT_ATTEND).active + def test_active_statuses_return_true(self): + assert AppointmentStatus(name=AppointmentStatus.CONFIRMED).active + assert AppointmentStatus(name=AppointmentStatus.CHECKED_IN).active + assert AppointmentStatus(name=AppointmentStatus.STARTED).active + assert not AppointmentStatus(name=AppointmentStatus.CANCELLED).active + assert not AppointmentStatus(name=AppointmentStatus.DID_NOT_ATTEND).active assert not AppointmentStatus( - state=AppointmentStatus.ATTENDED_NOT_SCREENED + name=AppointmentStatus.ATTENDED_NOT_SCREENED ).active assert not AppointmentStatus( - state=AppointmentStatus.PARTIALLY_SCREENED + name=AppointmentStatus.PARTIALLY_SCREENED ).active - assert not AppointmentStatus(state=AppointmentStatus.SCREENED).active + assert not AppointmentStatus(name=AppointmentStatus.SCREENED).active diff --git a/manage_breast_screening/participants/tests/test_presenters.py b/manage_breast_screening/participants/tests/test_presenters.py index f3b1420d4..e89c9b1cb 100644 --- a/manage_breast_screening/participants/tests/test_presenters.py +++ b/manage_breast_screening/participants/tests/test_presenters.py @@ -128,13 +128,13 @@ def test_ethnicity_actions(self, participant): class TestParticipantAppointmentPresenter: - def mock_appointment(self, starts_at, pk, state=AppointmentStatus.CONFIRMED): + def mock_appointment(self, starts_at, pk, status_name=AppointmentStatus.CONFIRMED): appointment = MagicMock(spec=Appointment) appointment.clinic_slot.starts_at = starts_at appointment.clinic_slot.clinic.get_type_display.return_value = "screening" appointment.clinic_slot.clinic.setting.name = "West of London BSS" appointment.pk = UUID(pk) - appointment.current_status = AppointmentStatus(state=state) + appointment.current_status = AppointmentStatus(name=status_name) return appointment @@ -153,12 +153,12 @@ def past_appointments(self): self.mock_appointment( starts_at=datetime(2023, 1, 1, 9, tzinfo=tz.utc), pk="e76163c8-a594-4991-890d-a02097c67a2f", - state=AppointmentStatus.PARTIALLY_SCREENED, + status_name=AppointmentStatus.PARTIALLY_SCREENED, ), self.mock_appointment( starts_at=datetime(2019, 1, 1, 9, tzinfo=tz.utc), pk="6473a629-e7c4-43ca-87f3-ab9526aab07c", - state=AppointmentStatus.SCREENED, + status_name=AppointmentStatus.SCREENED, ), ] diff --git a/manage_breast_screening/tests/system/clinical/test_appointment_buttons_on_clinic_page.py b/manage_breast_screening/tests/system/clinical/test_appointment_buttons_on_clinic_page.py index d3eca0f94..62d50f0bc 100644 --- a/manage_breast_screening/tests/system/clinical/test_appointment_buttons_on_clinic_page.py +++ b/manage_breast_screening/tests/system/clinical/test_appointment_buttons_on_clinic_page.py @@ -68,7 +68,7 @@ def and_there_are_appointments(self): self.in_progress_appointment = AppointmentFactory( clinic_slot__clinic=self.clinic, starts_at=datetime.now().replace(hour=11, minute=00, tzinfo=tzinfo), - current_status=AppointmentStatus.IN_PROGRESS, + current_status=AppointmentStatus.STARTED, ) def and_i_am_on_the_clinic_show_page(self): diff --git a/manage_breast_screening/tests/system/clinical/test_benign_lump_history.py b/manage_breast_screening/tests/system/clinical/test_benign_lump_history.py index b71d9e19a..d315e7c8a 100644 --- a/manage_breast_screening/tests/system/clinical/test_benign_lump_history.py +++ b/manage_breast_screening/tests/system/clinical/test_benign_lump_history.py @@ -67,7 +67,7 @@ def and_there_is_an_appointment(self): screening_episode=self.screening_episode, clinic_slot__clinic__setting__provider=self.current_provider, current_status_params={ - "state": AppointmentStatus.IN_PROGRESS, + "name": AppointmentStatus.STARTED, "created_by": self.current_user, }, ) diff --git a/manage_breast_screening/tests/system/clinical/test_breast_augmentation_history.py b/manage_breast_screening/tests/system/clinical/test_breast_augmentation_history.py index b50e898b0..b247ad650 100644 --- a/manage_breast_screening/tests/system/clinical/test_breast_augmentation_history.py +++ b/manage_breast_screening/tests/system/clinical/test_breast_augmentation_history.py @@ -56,7 +56,7 @@ def and_there_is_an_appointment(self): screening_episode=self.screening_episode, clinic_slot__clinic__setting__provider=self.current_provider, current_status_params={ - "state": AppointmentStatus.IN_PROGRESS, + "name": AppointmentStatus.STARTED, "created_by": self.current_user, }, ) diff --git a/manage_breast_screening/tests/system/clinical/test_breast_cancer_history.py b/manage_breast_screening/tests/system/clinical/test_breast_cancer_history.py index 8803a56e6..c1a3e943e 100644 --- a/manage_breast_screening/tests/system/clinical/test_breast_cancer_history.py +++ b/manage_breast_screening/tests/system/clinical/test_breast_cancer_history.py @@ -72,7 +72,7 @@ def and_there_is_an_appointment(self): screening_episode=self.screening_episode, clinic_slot__clinic__setting__provider=self.current_provider, current_status_params={ - "state": AppointmentStatus.IN_PROGRESS, + "name": AppointmentStatus.STARTED, "created_by": self.current_user, }, ) diff --git a/manage_breast_screening/tests/system/clinical/test_cannot_go_ahead_form.py b/manage_breast_screening/tests/system/clinical/test_cannot_go_ahead_form.py index 7bf9e9ef9..02d85a513 100644 --- a/manage_breast_screening/tests/system/clinical/test_cannot_go_ahead_form.py +++ b/manage_breast_screening/tests/system/clinical/test_cannot_go_ahead_form.py @@ -100,7 +100,7 @@ def then_i_see_the_clinics_page(self): def and_the_appointment_is_updated(self): self.appointment.refresh_from_db() self.assertEqual( - self.appointment.current_status.state, + self.appointment.current_status.name, AppointmentStatus.ATTENDED_NOT_SCREENED, ) self.assertEqual(self.appointment.reinvite, True) 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 2fe49b18f..43c638fe5 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 @@ -66,7 +66,7 @@ def test_accessibility(self): def test_status_attribution_display(self): self.given_i_am_logged_in_as_a_clinical_user() self.and_a_clinic_exists_that_is_run_by_my_provider() - self.and_there_are_appointments_in_various_states_with_attributed_users() + 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() @@ -109,7 +109,7 @@ def and_there_are_appointments(self): self.in_progress_appointment = AppointmentFactory( clinic_slot__clinic=self.clinic, starts_at=datetime.now().replace(hour=11, minute=00, tzinfo=tzinfo), - current_status=AppointmentStatus.IN_PROGRESS, + current_status=AppointmentStatus.STARTED, ) def and_i_am_on_the_clinic_list(self): @@ -212,6 +212,11 @@ def and_the_appointments_remain_in_the_same_order(self): def _expect_rows_to_match_appointments(self, rows, appointments): assert len(rows) == len(appointments) for row, appointment in zip(rows, appointments): + expected_status_tag = ( + "In progress" + if appointment.current_status.is_in_progress() + else appointment.current_status.get_name_display() + ) expect(row.locator("td").nth(0)).to_have_text( format_time(appointment.clinic_slot.starts_at) ) @@ -227,9 +232,7 @@ def _expect_rows_to_match_appointments(self, rows, appointments): expect(row.locator("td").nth(2)).to_contain_text( format_age(appointment.screening_episode.participant.age()) ) - expect(row.locator("td").nth(3)).to_contain_text( - appointment.current_status.get_state_display() - ) + expect(row.locator("td").nth(3)).to_contain_text(expected_status_tag) def and_an_appointment_has_extra_needs(self): self.extra_needs_appointment = AppointmentFactory( @@ -261,7 +264,7 @@ def then_i_can_see_the_special_appointment_banner(self): expect(banner).to_contain_text("Special appointment") expect(banner).to_contain_text("Wheelchair user") - def and_there_are_appointments_in_various_states_with_attributed_users(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") @@ -275,14 +278,14 @@ def and_there_are_appointments_in_various_states_with_attributed_users(self): last_name="Confirmed", ) - # IN_PROGRESS status + # STARTED status self.in_progress_appointment = AppointmentFactory( clinic_slot__clinic=self.clinic, first_name="Participant", last_name="InProgress", ) self.in_progress_appointment.statuses.create( - state=AppointmentStatus.IN_PROGRESS, + name=AppointmentStatus.STARTED, created_by=user_in_progress, ) @@ -293,7 +296,7 @@ def and_there_are_appointments_in_various_states_with_attributed_users(self): last_name="Screened", ) self.screened_appointment.statuses.create( - state=AppointmentStatus.SCREENED, + name=AppointmentStatus.SCREENED, created_by=user_screened, ) @@ -304,7 +307,7 @@ def and_there_are_appointments_in_various_states_with_attributed_users(self): last_name="Cancelled", ) self.cancelled_appointment.statuses.create( - state=AppointmentStatus.CANCELLED, + name=AppointmentStatus.CANCELLED, created_by=user_cancelled, ) diff --git a/manage_breast_screening/tests/system/clinical/test_cyst_history.py b/manage_breast_screening/tests/system/clinical/test_cyst_history.py index 905e08f2b..e64cb1fca 100644 --- a/manage_breast_screening/tests/system/clinical/test_cyst_history.py +++ b/manage_breast_screening/tests/system/clinical/test_cyst_history.py @@ -50,7 +50,7 @@ def and_there_is_an_appointment(self): screening_episode=self.screening_episode, clinic_slot__clinic__setting__provider=self.current_provider, current_status_params={ - "state": AppointmentStatus.IN_PROGRESS, + "name": AppointmentStatus.STARTED, "created_by": self.current_user, }, ) diff --git a/manage_breast_screening/tests/system/clinical/test_implanted_medical_device_history.py b/manage_breast_screening/tests/system/clinical/test_implanted_medical_device_history.py index 01b5d9e8d..f81a72f7d 100644 --- a/manage_breast_screening/tests/system/clinical/test_implanted_medical_device_history.py +++ b/manage_breast_screening/tests/system/clinical/test_implanted_medical_device_history.py @@ -56,7 +56,7 @@ def and_there_is_an_appointment(self): screening_episode=self.screening_episode, clinic_slot__clinic__setting__provider=self.current_provider, current_status_params={ - "state": AppointmentStatus.IN_PROGRESS, + "name": AppointmentStatus.STARTED, "created_by": self.current_user, }, ) diff --git a/manage_breast_screening/tests/system/clinical/test_mastectomy_or_lumpectomy_history.py b/manage_breast_screening/tests/system/clinical/test_mastectomy_or_lumpectomy_history.py index 6c6fb4430..60dd7dcf9 100644 --- a/manage_breast_screening/tests/system/clinical/test_mastectomy_or_lumpectomy_history.py +++ b/manage_breast_screening/tests/system/clinical/test_mastectomy_or_lumpectomy_history.py @@ -53,7 +53,7 @@ def and_there_is_an_appointment(self): screening_episode=self.screening_episode, clinic_slot__clinic__setting__provider=self.current_provider, current_status_params={ - "state": AppointmentStatus.IN_PROGRESS, + "name": AppointmentStatus.STARTED, "created_by": self.current_user, }, ) diff --git a/manage_breast_screening/tests/system/clinical/test_other_procedure_history.py b/manage_breast_screening/tests/system/clinical/test_other_procedure_history.py index 13ab4398f..003eccfb1 100644 --- a/manage_breast_screening/tests/system/clinical/test_other_procedure_history.py +++ b/manage_breast_screening/tests/system/clinical/test_other_procedure_history.py @@ -61,7 +61,7 @@ def and_there_is_an_appointment(self): screening_episode=self.screening_episode, clinic_slot__clinic__setting__provider=self.current_provider, current_status_params={ - "state": AppointmentStatus.IN_PROGRESS, + "name": AppointmentStatus.STARTED, "created_by": self.current_user, }, ) diff --git a/manage_breast_screening/tests/system/clinical/test_recording_symptoms.py b/manage_breast_screening/tests/system/clinical/test_recording_symptoms.py index 86294bdf4..fdd214426 100644 --- a/manage_breast_screening/tests/system/clinical/test_recording_symptoms.py +++ b/manage_breast_screening/tests/system/clinical/test_recording_symptoms.py @@ -101,7 +101,7 @@ def and_there_is_an_appointment(self): screening_episode=self.screening_episode, clinic_slot__clinic__setting__provider=self.current_provider, current_status_params={ - "state": AppointmentStatus.IN_PROGRESS, + "name": AppointmentStatus.STARTED, "created_by": self.current_user, }, ) diff --git a/manage_breast_screening/tests/system/clinical/test_reviewing_medical_information.py b/manage_breast_screening/tests/system/clinical/test_reviewing_medical_information.py index abd6a78a9..e2acc310c 100644 --- a/manage_breast_screening/tests/system/clinical/test_reviewing_medical_information.py +++ b/manage_breast_screening/tests/system/clinical/test_reviewing_medical_information.py @@ -43,7 +43,7 @@ def and_there_is_an_appointment(self): screening_episode=self.screening_episode, clinic_slot__clinic__setting__provider=self.current_provider, current_status_params={ - "state": AppointmentStatus.IN_PROGRESS, + "name": AppointmentStatus.STARTED, "created_by": self.current_user, }, )