Skip to content

Commit

Permalink
calculate tiered prices by sponsor, not journal
Browse files Browse the repository at this point in the history
  • Loading branch information
ryscher committed Apr 4, 2023
1 parent a58311d commit 7efca14
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 7efca14

Please sign in to comment.