Skip to content

Commit

Permalink
Show awarded and declined personas
Browse files Browse the repository at this point in the history
The new stage field combined them in to a single "completed" stage, but
we want to split these out so we can choose between awarded and
declined personas.
  • Loading branch information
thomasleese committed Nov 24, 2023
1 parent 1f01f94 commit caa3109
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
23 changes: 17 additions & 6 deletions app/controllers/personas_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ def load_eligible_personas
%w[online written none]
.product(
%w[online written none],
%w[draft not_started verification completed],
%w[draft not_started verification awarded declined],
)
.map do |status_check, sanction_check, stage|
{ status_check:, sanction_check:, stage: }
.map do |status_check, sanction_check, stage_or_status|
{ status_check:, sanction_check:, stage_or_status: }
end

def load_teacher_personas
Expand All @@ -141,9 +141,20 @@ def load_teacher_personas
all_application_forms.find do |application_form|
region = application_form.region

region.status_check == persona[:status_check] &&
region.sanction_check == persona[:sanction_check] &&
application_form.stage == persona[:stage]
unless region.status_check == persona[:status_check] &&
region.sanction_check == persona[:sanction_check]
next
end

stage_or_status = persona[:stage_or_status]

if stage_or_status == "awarded"
application_form.awarded_at.present?
elsif stage_or_status == "declined"
application_form.declined_at.present?
else
application_form.stage == stage_or_status
end
end

if (application_form = found_application_form)
Expand Down
4 changes: 2 additions & 2 deletions app/views/personas/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
row.with_cell(header: true, text: "Country")
row.with_cell(header: true, text: "Status check")
row.with_cell(header: true, text: "Sanction check")
row.with_cell(header: true, text: "Stage")
row.with_cell(header: true, text: "Stage/status")
row.with_cell(header: true, text: "Email address")
row.with_cell(header: true, text: "Actions", numeric: true)
end
Expand All @@ -143,7 +143,7 @@
row.with_cell { persona_check_tag(persona[:status_check]) }
row.with_cell { persona_check_tag(persona[:sanction_check]) }
row.with_cell do
render(StatusTag::Component.new(persona[:stage]))
render(StatusTag::Component.new(persona[:stage_or_status]))
end
row.with_cell { persona[:teacher].email }

Expand Down

0 comments on commit caa3109

Please sign in to comment.