Skip to content

Commit

Permalink
tweak practitioner claim start timestamp
Browse files Browse the repository at this point in the history
- this is now when practitioner submits their reference number
  • Loading branch information
asmega committed Nov 8, 2024
1 parent 88d62a2 commit f49bbfe
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ def generate_policy_options_provided
end

def new_or_find_claim
Claim.find_by(reference: journey_session.answers.reference_number) || Claim.new
(Claim.find_by(reference: journey_session.answers.reference_number) || Claim.new).tap do |c|
if c.eligibility
c.eligibility.practitioner_claim_started_at = journey_session.answers.practitioner_claim_started_at
end
end
end

def set_submitted_at_attributes
claim.eligibility.practitioner_claim_started_at = journey_session.created_at
claim.submitted_at = Time.zone.now
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ def save
reference_number:,
reference_number_found: existing_claim.present?,
claim_already_submitted: existing_claim&.submitted?,
nursery_name: existing_claim&.eligibility&.eligible_ey_provider&.nursery_name
nursery_name: existing_claim&.eligibility&.eligible_ey_provider&.nursery_name,
practitioner_claim_started_at: Time.now
)
journey_session.save!
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class SessionAnswers < Journeys::SessionAnswers
attribute :claim_already_submitted, :boolean, default: nil
attribute :nursery_name
attribute :start_email, :string
attribute :practitioner_claim_started_at, :datetime

def policy
Policies::EarlyYearsPayments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
banking_name { "John Doe" }
bank_sort_code { rand(100000..999999) }
bank_account_number { rand(10000000..99999999) }
practitioner_claim_started_at { 30.minutes.ago }
end

trait :submittable do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@
}.to change { journey_session.reload.answers.nursery_name }.from(nil).to(eligible_ey_provider.nursery_name)
end

it "sets practitioner_claim_started_at" do
expect {
subject.save
}.to change { journey_session.reload.answers.practitioner_claim_started_at }.from(nil)
end

context "when the claim has only been submitted by the provider, not the practitioner" do
let(:claim) do
create(
Expand Down

0 comments on commit f49bbfe

Please sign in to comment.