From 33918a549a3159867359691c8230b4fa7c2e83bc Mon Sep 17 00:00:00 2001 From: martent Date: Mon, 15 Apr 2019 10:57:25 +0200 Subject: [PATCH] Followup report: don't calculate cost after the day before citizenship_at --- app/reports/helpers/economy_followup_report_helper.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/reports/helpers/economy_followup_report_helper.rb b/app/reports/helpers/economy_followup_report_helper.rb index 7ffdded..0928ccf 100644 --- a/app/reports/helpers/economy_followup_report_helper.rb +++ b/app/reports/helpers/economy_followup_report_helper.rb @@ -2,6 +2,12 @@ module EconomyFollowupReportHelper def economy_per_month(refugee, age_group, po_rates) (1..12).map do |month| interval_for_costs = age_cutoff(month, refugee, age_group, cost: true) + + # For this report only: don't calculate cost after citizenship_at - 1 day + if refugee.citizenship_at? + interval_for_costs[:to] = earliest_date(interval_for_costs[:to], refugee.citizenship_at - 1.day) + end + interval_for_income = age_cutoff(month, refugee, age_group) [ days_with_placements(refugee, interval_for_costs),