From 4b9eb2fc6d40949da99448ad8f9f276e6691206c Mon Sep 17 00:00:00 2001 From: mw Date: Mon, 5 Dec 2022 09:44:49 -0500 Subject: [PATCH] changed back costreport output path --- lib/reports/cost_report.rb | 12 +++++++++--- spec/integration_spec.rb | 4 ++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lib/reports/cost_report.rb b/lib/reports/cost_report.rb index 2423f344..2513e9a5 100644 --- a/lib/reports/cost_report.rb +++ b/lib/reports/cost_report.rb @@ -190,9 +190,15 @@ def total_cost_for_member(member) private def report_file - FileUtils.mkdir_p(Settings.cost_report_path) - iso_stamp = Time.now.strftime("%Y%m%d-%H%M%S") - File.join(Settings.cost_report_path, "cost_report_#{iso_stamp}.txt") + year = Time.now.year.to_s + FileUtils.mkdir_p(File.join(Settings.cost_report_path, year)) + iso_stamp = Time.now.strftime("%Y%m%d") + + File.join( + Settings.cost_report_path, + year, + "cost_report_#{iso_stamp}.tsv" + ) end end end diff --git a/spec/integration_spec.rb b/spec/integration_spec.rb index 2658c8b9..4b5e49eb 100644 --- a/spec/integration_spec.rb +++ b/spec/integration_spec.rb @@ -98,8 +98,8 @@ def cleanup(output) it "CostReport produces output" do phctl(*%w[report costreport]) - - expect(File.read(Dir.glob("/tmp/cost_reports/*").first)) + year = Time.new.year.to_s + expect(File.read(Dir.glob("/tmp/cost_reports/#{year}/*").first)) .to match(/Target cost: 9999/) end