-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup the admin to display IRP claims
In order to be able to display the IRP claims in the admin, there are some basic methods that need to be available. This change ensures the minimum implementation for displaying claims without being concerned about the correctness of the required methods. Specifically the `award_amount` is a placeholder. In order to ensure we can successfully check for duplicate claims, I made an assumption that we would use passport number rather than teacher reference number as a unique identifier. I don't think claimants for IRP will have TRNs, therefore we need some other way of matching. We can change this assumption easily in the future but for now this allows us to ship the admin changes and keep moving forward.
- Loading branch information
1 parent
fbb7689
commit a817b0f
Showing
17 changed files
with
149 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
app/models/policies/international_relocation_payments/admin_tasks_presenter.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module Policies | ||
module InternationalRelocationPayments | ||
class AdminTasksPresenter | ||
include Admin::PresenterMethods | ||
|
||
attr_reader :claim | ||
|
||
def initialize(claim) | ||
@claim = claim | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
app/models/policies/international_relocation_payments/eligibility_admin_answers_presenter.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
module Policies | ||
module InternationalRelocationPayments | ||
class EligibilityAdminAnswersPresenter | ||
include Admin::PresenterMethods | ||
|
||
attr_reader :eligibility | ||
|
||
def initialize(eligibility) | ||
@eligibility = eligibility | ||
end | ||
|
||
def answers | ||
[].tap do |a| | ||
a << current_school | ||
end | ||
end | ||
|
||
private | ||
|
||
def current_school | ||
[ | ||
translate("admin.current_school"), | ||
eligibility.current_school.present? ? display_school(eligibility.current_school) : "No" | ||
] | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
spec/factories/policies/international_relocation_payments/eligibilities.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
FactoryBot.define do | ||
factory :international_relocation_payments_eligibility, class: "Policies::InternationalRelocationPayments::Eligibility" do | ||
trait :eligible_home_office do | ||
passport_number { "123456789" } | ||
nationality { "French" } | ||
end | ||
|
||
trait :eligible do | ||
eligible_home_office | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
spec/models/policies/international_relocation_payments/admin_tasks_presenter_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe Policies::InternationalRelocationPayments::AdminTasksPresenter, type: :model do | ||
subject { presenter } | ||
|
||
let(:claim) { build(:claim, policy: Policies::InternationalRelocationPayments) } | ||
let(:eligibility) { claim.eligibility } | ||
let(:presenter) { described_class.new(claim) } | ||
|
||
describe "#claim" do | ||
subject { presenter.claim } | ||
|
||
it { is_expected.to eq claim } | ||
end | ||
end |
13 changes: 13 additions & 0 deletions
13
...ls/policies/international_relocation_payments/eligibility_admin_answers_presenter_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe Policies::InternationalRelocationPayments::EligibilityAdminAnswersPresenter, type: :model do | ||
let(:claim) { build(:claim, :submittable, policy: Policies::InternationalRelocationPayments, academic_year: "2021/2022") } | ||
|
||
subject(:presenter) { described_class.new(claim.eligibility) } | ||
|
||
describe "#answers" do | ||
it "returns an array of questions and answers for displaying to service operator" do | ||
expect(presenter.answers).to eq [[I18n.t("admin.current_school"), "No"]] | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters