Skip to content

Instantly share code, notes, and snippets.

@mmeigooni
Created June 11, 2013 18:48
Show Gist options
  • Save mmeigooni/5759573 to your computer and use it in GitHub Desktop.
Save mmeigooni/5759573 to your computer and use it in GitHub Desktop.
results = "month,chan1_earnings,chan2_earnings,chan_total_earnings,user_earnings,same?\n"
u1 = "4e8b13ae6ef2a600010000e4"
c1 = "4e8f1f202d1442000100018f"
c2 = "4e8b13ad6ef2a600010000e3"
months = [-6..-1]
earn1 = []
earn2 = []
u_earn = []
months.each do |month|
earn1 << Channel.find(c1).earnings[month]
earn2 << Channel.find(c2).earnings[month]
u_earn << PaymentInfo.where(user_id: u1)[month]
end
earn1.flatten!
earn2.flatten!
u_earn.flatten!
0.upto(5).each do |i|
chan1_earnings = earn1[i].total_revenue
chan2_earnings = earn2[i].total_revenue
user_earnings = u_earn[i].total.to_f
if chan1_earnings + chan2_earnings == user_earnings
results << "#{i},#{chan1_earnings},#{chan2_earnings},#{chan1_earnings + chan2_earnings},#{user_earnings},yes\n"
else
results << "#{i},#{chan1_earnings},#{chan2_earnings},#{chan1_earnings + chan2_earnings},#{user_earnings},no\n"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment