Conversation
2e33c74 to
5436ce6
Compare
| for step in AppointmentWorkflowStepCompletion.StepNames: | ||
| is_completed = step.name in self.completed_steps | ||
| is_current = step.name == active_workflow_step | ||
| is_disabled = not all_previous_steps_completed and not is_current |
There was a problem hiding this comment.
Changed this line so that in the case where the current step is complete it can still be disabled.
In the case of taking over an appointment, completed_steps will include later steps completed by the original user, but not CONFIRM_IDENTITY.
| self.appointment.completed_workflow_steps.values_list( | ||
| "step_name", flat=True | ||
| ).distinct() | ||
| self.appointment.completed_workflow_steps.filter( |
There was a problem hiding this comment.
This now filters out CONFIRM_IDENTITY steps completed by someone other than the current user.
swebberuk
left a comment
There was a problem hiding this comment.
Looks good to me. Will need to resolve conflicts before merging.
f9c18c7 to
5436ce6
Compare
Previously this test was mixed in with the test of medical history, but I'd like to cover everything to do with workflow state in test_mammogram_workflow.py. The previous test actually tested a nonsensical situation where pausing and resuming kicks you back to confirm identity. This is because the medical history test is jumping into the middle of an appointment, and AppointmentWorkflowStepCompletion hasn't been populated properly. This is the case for several other appointment tests as well. It is likely not causing problems because of a lax enforcement of workflow state that we should address. The new version of the test goes through the workflow from the beginning so the AppointmentWorkflowCompletion data is in the correct state.
When computing the completed workflow steps, don't count Confirm Identity as completed if it was completed by another user.
- Delegate to AppointmentWorkflowService for this - Extract out into a different presenter, as AppointmentPresenter has too many responsibilities
In the case where a user takes over an appointment from another user, we redirect them to confirm identity regardless of whether the other user completed it. However, if the first user completed later steps, the workflow sidebar was showing these steps as clickable links, providing a route to bypass the identity check. This commit ensures that those later steps will be considered disabled and the link not rendered. In this case the steps are both disabled and complete, so we should show a checked icon, but in grey (to match disabled steps with numbers).
5436ce6 to
20110fa
Compare
|
|
The review app at this URL has been deleted: |



Description
We have implemented a rule,
is_identity_confirmed_by_user, meaning that an identity check completed by one user doesn't count if a second user takes the appointment over.This logic is being used to redirect the user to the appropriate step when resuming an appointment, but it was not being applied when rendering the workflow sidebar, creating two bugs:
I've changed this so that the identity check step is correctly marked as not completed, and the following steps are greyed out even if complete.
Taking over other people's appointments has not been fully considered in the prototype yet, but we have a design ticket to think about this further: https://nhsd-jira.digital.nhs.uk/browse/DTOSS-11468
In the meantime, this change should make the sidebar and redirect behaviour consistent with each other.
It is still possible to bypass workflow steps by hacking the URL, but I've raised DTOSS-12594 to deal with that separately.
Jira link
https://nhsd-jira.digital.nhs.uk/browse/DTOSS-12593
Review notes
Please let me know if there's any improvements that could be made to the tests here. I'd like to ensure we have good coverage, and there might be states I haven't thought of.
Review checklist
/api/v1/), confirm whether it is a breaking change — if so, a new major version (/api/v2/) is required (see ADR-006)