Skip to content

Commit

Permalink
Merge pull request #241 from hathitrust/DEV-529
Browse files Browse the repository at this point in the history
changed back costreport output path
  • Loading branch information
mwarin authored Dec 5, 2022
2 parents 1f72ef0 + 4b9eb2f commit af48b8f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
12 changes: 9 additions & 3 deletions lib/reports/cost_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions spec/integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit af48b8f

Please sign in to comment.