Skip to content

Commit 50c558a

Browse files
committed
Refactor set_programme_statuses
To make the approach consistent and less brittle if the status keys change.
1 parent f7793c0 commit 50c558a

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

app/controllers/patients_controller.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ def set_programme_statuses
9696
[]
9797
else
9898
Patient::ProgrammeStatus.statuses.keys -
99-
%w[not_eligible needs_consent_follow_up_requested]
99+
Patient::ProgrammeStatus::NOT_ELIGIBLE_STATUSES.keys -
100+
%w[needs_consent_follow_up_requested]
100101
end
101102
end
102103

app/controllers/schools/patients_controller.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def index
5454
def set_programme_statuses
5555
@programme_statuses =
5656
Patient::ProgrammeStatus.statuses.keys -
57-
%w[not_eligible needs_consent_follow_up_requested]
57+
Patient::ProgrammeStatus::NOT_ELIGIBLE_STATUSES.keys -
58+
%w[needs_consent_follow_up_requested]
5859
end
5960
end

app/controllers/sessions/base_controller.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ def set_session
1717
def set_programme_statuses
1818
@programme_statuses =
1919
Patient::ProgrammeStatus.statuses.keys -
20-
%w[not_eligible needs_consent_follow_up_requested]
20+
Patient::ProgrammeStatus::NOT_ELIGIBLE_STATUSES.keys -
21+
%w[needs_consent_follow_up_requested]
2122
end
2223
end

0 commit comments

Comments
 (0)