Skip to content

Commit

Permalink
Merge pull request #1163 from CDL-Dryad/tiered-adjustments
Browse files Browse the repository at this point in the history
Adjust tiered reports to calculate prices by sponsor, not journal
  • Loading branch information
sfisher authored Apr 11, 2023
2 parents e5d4e8a + 7efca14 commit 8d22a18
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/tasks/stash_engine_tasks.rake
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,7 @@ namespace :identifiers do
CSV.open(tiered_filename, 'w') do |csv|
csv << %w[SponsorName JournalName Count Price]
sponsor_summary = []
sponsor_total_count = 0
StashEngine::JournalOrganization.all.each do |org|
journals = org.journals_sponsored_deep
journals.each do |j|
Expand All @@ -605,13 +606,16 @@ namespace :identifiers do
sponsor_summary << [item['DOI'], j.title, item['ApprovalDate']]
end
end
csv << [org.name, j.title, journal_item_count, tiered_price(journal_item_count)]
csv << [org.name, j.title, journal_item_count, '']
sponsor_total_count += journal_item_count
end
next if sponsor_summary.blank?

csv << [org.name, 'TOTAL', sponsor_total_count, tiered_price(sponsor_total_count)]
write_tiered_sponsor_summary(name: org.name, file_prefix: prefix, report_period: time_period,
table: sponsor_summary)
sponsor_summary = []
sponsor_total_count = 0
end
end

Expand Down

0 comments on commit 8d22a18

Please sign in to comment.