Skip to content

Commit

Permalink
Fix assigning SLC plan 1
Browse files Browse the repository at this point in the history
When a claim without a student loan plan is amended the student loan
plan was being set to Plan 1, the default option in the list.
This commit includes a blank option so unrelated amendments on a claims
without a plan don't send up the Plan 1 value.
  • Loading branch information
rjlynch committed Nov 7, 2024
1 parent 641cdc7 commit d84e3ef
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/admin/amendments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def ensure_claim_is_amendable
end

def claim_params
params.require(:amendment).require(:claim).permit(*amendable_attributes)
params.require(:amendment).require(:claim).permit(*amendable_attributes).compact_blank
end

def amendable_attributes
Expand Down
7 changes: 6 additions & 1 deletion app/views/admin/amendments/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,12 @@
</div>
<div class="govuk-grid-column-two-thirds">
<div class="govuk-form-group">
<%= claim_form.select :student_loan_plan, Claim::STUDENT_LOAN_PLAN_OPTIONS.map { |option| [option.humanize, option] }, {}, { class: "govuk-select" } %>
<%= claim_form.select(
:student_loan_plan,
Claim::STUDENT_LOAN_PLAN_OPTIONS.map { |option| [option.humanize, option] },
{ include_blank: true },
{ class: "govuk-select" }
) %>
</div>
</div>
</div>
Expand Down

0 comments on commit d84e3ef

Please sign in to comment.