Skip to content

Instantly share code, notes, and snippets.

@mattfitzgerald
Created July 31, 2013 07:26
Show Gist options
  • Save mattfitzgerald/6120026 to your computer and use it in GitHub Desktop.
Save mattfitzgerald/6120026 to your computer and use it in GitHub Desktop.
year = 2013
months = (1..6)
months.each do |month|
start_date = Date.new(year,month,1)
end_date = start_date + 1.month
total = Payment.where(item: 'subscription', transaction_state: 'success', created_at: start_date..end_date).sum(:amount_in_cents)/100.0
puts "year: #{year} month: #{month} total_subs: #{total}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment