From b6d1db463cdd8ebca3bebf90850ec2809dd2cafe Mon Sep 17 00:00:00 2001 From: Joe Haig Date: Tue, 11 Jul 2023 09:25:40 +0100 Subject: [PATCH] Add bill type to report I think this is the correct value --- .../reports/provisional_assessments_new.rb | 20 +++++++++++++------ .../provisional_assessments_new_spec.rb | 2 +- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/app/services/reports/provisional_assessments_new.rb b/app/services/reports/provisional_assessments_new.rb index d564b7be0c..5abff119e9 100644 --- a/app/services/reports/provisional_assessments_new.rb +++ b/app/services/reports/provisional_assessments_new.rb @@ -21,7 +21,7 @@ class ProvisionalAssessmentsNew } ].freeze - def self.call = new.call + def self.call(...) = new(...).call def call Claim::BaseClaim.includes(INCLUDES) @@ -31,12 +31,20 @@ def call private - def format_row(claim) - total = claim.total_including_vat - assessed = claim.amount_assessed + def format_row(claim) = summary_fields(claim) + extended_fields(claim) + + def summary_fields(claim) + [ + claim.provider.name, + claim.total_including_vat, + claim.amount_assessed, + claim.total_including_vat - claim.amount_assessed + ] + end + + def extended_fields(claim) [ - claim.provider.name, total, assessed, total - assessed, - 'TBD - Bill type', + claim.type.gsub('Claim::', ''), claim.case_type.name, claim.earliest_representation_order_date, claim.case_workers.last.name, diff --git a/spec/services/reports/provisional_assessments_new_spec.rb b/spec/services/reports/provisional_assessments_new_spec.rb index fb57275738..7955209452 100644 --- a/spec/services/reports/provisional_assessments_new_spec.rb +++ b/spec/services/reports/provisional_assessments_new_spec.rb @@ -64,7 +64,7 @@ it { expect(call.first[1]).to eq(claim.total_including_vat) } it { expect(call.first[2]).to eq(claim.amount_assessed) } it { expect(call.first[3]).to eq(claim.total_including_vat - claim.amount_assessed) } - # it { expect(call.first[4]).to eq(Bill type) } + it { expect(call.first[4]).to eq('AdvocateClaim') } it { expect(call.first[5]).to eq(claim.case_type.name) } it { expect(call.first[6]).to eq(claim.earliest_representation_order_date) } it { expect(call.first[7]).to eq(claim.case_workers.last.name) }