Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CAPT-1898] Practitioner claim start timestamp #3381

Merged
merged 2 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Empty file removed scratch
Empty file.
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