Last active
August 29, 2015 14:06
-
-
Save bry4n/19246ac5522f4fee15db to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 6,357 Qualified Candidates | |
# 116 Qualified candidates with line items - $7,685 | |
# 189 Line items WITHOUT invoice - $14,365 | |
# 1,005 Line items WITH invoice - $23,500 | |
# 1,194 Line items (with invoice, without invoice) - $37,865 | |
qualified_candidate_ids = [] | |
AbilityScreenApplication.includes({assessment: [:user, :candidate]}, :ability_screen).find_each do |asa| | |
next unless asa.assessment | |
next unless asa.assessment.user.present? | |
next unless asa.qualified? | |
qualified_candidate_ids << asa.id | |
end | |
puts "#{qualified_candidate_ids.size} Qualified Candidates" | |
line_items = LineItem.where(chargeable_type: "AbilityScreenApplication", chargeable_id: qualified_candidate_ids).without_invoice | |
total_amount =LineItem.where(chargeable_type: "AbilityScreenApplication", chargeable_id: qualified_candidate_ids).without_invoice.sum(:amount) / 100 | |
puts "#{line_items.size} qualified candidates with line items - $#{total_amount}" | |
lt_count = LineItem.without_invoice.count | |
lt_amount = LineItem.without_invoice.sum(:amount) / 100 | |
puts "#{lt_count} Line items WITHOUT invoice - $#{lt_amount}" | |
lt_count = LineItem.with_invoice.count | |
lt_amount = LineItem.with_invoice.sum(:amount) / 100 | |
puts "#{lt_count} Line items WITH invoice - $#{lt_amount}" | |
lt_count = LineItem.count | |
lt_amount = LineItem.sum(:amount) / 100 | |
puts "#{lt_count} Line items (with invoice, without invoice) - $#{lt_amount}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment