Skip to content

Commit

Permalink
Merge pull request #1137 from DFE-Digital/fix-financial-year-in-emplo…
Browse files Browse the repository at this point in the history
…yment-task

Display the correct financial year in employment check
  • Loading branch information
jacksonj04 authored Sep 2, 2020
2 parents dfef650 + 007ed17 commit fca7ef6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ The format is based on [Keep a Changelog]
## [Unreleased]

- Break down number of claims and claim amount in payroll runs by policy
- Display the correct financial year for employment as part of the employment
task.

## [Release 081] - 2020-09-01

Expand Down
9 changes: 8 additions & 1 deletion app/models/student_loans/admin_tasks_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def qualifications

def employment
[
["6 April 2018 to 5 April 2019", display_school(eligibility.claim_school)],
[financial_year_for_academic_year(claim.academic_year), display_school(eligibility.claim_school)],
[translate("admin.current_school"), display_school(eligibility.current_school)]
]
end
Expand All @@ -43,5 +43,12 @@ def identity_confirmation
def eligibility
claim.eligibility
end

def financial_year_for_academic_year(academic_year)
end_year = academic_year.start_year
start_year = end_year - 1

"6 April #{start_year} to 5 April #{end_year}"
end
end
end
13 changes: 13 additions & 0 deletions spec/models/student_loans/admin_tasks_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@
[I18n.t("admin.current_school"), presenter.display_school(eligibility.current_school)]
]
end
it "correctly returns the expected string for financial year" do
claim_2025 = build(:claim,
academic_year: "2025/2026",
student_loan_plan: StudentLoan::PLAN_1,
eligibility: build(
:student_loans_eligibility,
qts_award_year: "on_or_after_cut_off_date",
claim_school: school,
current_school: school
))
presenter_2025 = described_class.new(claim_2025)
expect(presenter_2025.employment[0][0]).to eq "6 April 2024 to 5 April 2025"
end
end

describe "#student_loan_amount" do
Expand Down

0 comments on commit fca7ef6

Please sign in to comment.