Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions app/components/app_session_patient_table_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def column_name(column)
action: "Action needed",
dob: "Date of birth",
name: "Full name",
outcome: "Outcome",
status: "Status",
postcode: "Postcode",
reason: "Reason for refusal",
select_for_matching: "Action",
Expand All @@ -61,9 +61,12 @@ def column_value(patient, column)
patient_session = @patient_sessions[patient]

case column
when :action, :outcome
when :action
state = patient_session&.state || "not_in_session"
t("patient_session_statuses.#{state}.text")
when :status
state = patient_session&.state || "not_in_session"
t("patient_session_statuses.#{state}.banner_title")
when :dob
patient.date_of_birth.to_fs(:long)
when :name
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/concerns/patient_sorting_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ def sort_by_value(obj, key)
obj.try(:date_of_birth) || obj.patient.date_of_birth
when "name"
obj.try(:full_name) || obj.patient.full_name
when "outcome"
obj.state
when "status"
obj.try(:state) || "not_in_session"
when "postcode"
obj.try(:address_postcode) || obj.patient.address_postcode
when "year_group"
Expand Down
2 changes: 1 addition & 1 deletion app/views/programme/patients/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<%= render AppSessionPatientTableComponent.new(
caption: t("children", count: @pagy.count),
columns: %i[name dob year_group outcome],
columns: %i[name dob year_group status],
params:,
patients: @patients,
patient_sessions: @patient_sessions,
Expand Down
5 changes: 3 additions & 2 deletions app/views/register_attendances/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
<%= h1 "Register attendance" %>

<%= render AppSessionPatientTableComponent.new(
caption: t("patients_table.register_attendance.caption", children: t("children", count: @patient_sessions.count)),
columns: %i[name year_group outcome attendance],
caption: t("patients_table.register_attendance.caption",
children: t("children", count: @patient_sessions.count)),
columns: %i[name year_group status attendance],
params:,
patient_sessions: @patient_sessions,
section: :attendance,
Expand Down
4 changes: 3 additions & 1 deletion app/views/vaccinations/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@

<%= render AppSessionPatientTableComponent.new(
caption: t("patients_table.#{@current_tab}.caption", children: t("children", count: @patient_sessions.count)),
columns: @current_tab == :vaccinate ? %i[name year_group action] : %i[name year_group outcome],
columns: @current_tab == :vaccinate ?
%i[name year_group action] :
%i[name year_group status],
params:,
patient_sessions: @patient_sessions,
section: :vaccinations,
Expand Down
1 change: 1 addition & 0 deletions config/locales/patient_session_statuses.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ en:
patient_session_statuses:
not_in_session:
text: Not in a session
banner_title: Not in session
added_to_session:
colour: blue
text: Get consent
Expand Down
6 changes: 3 additions & 3 deletions spec/components/app_session_patient_table_component_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,10 @@ def have_column(text)
it { should have_column("Action needed") }
end

context "includes outcome" do
let(:columns) { %i[name year_group outcome] }
context "includes status" do
let(:columns) { %i[name year_group status] }

it { should have_column("Outcome") }
it { should have_column("Status") }
end
end
end
Loading