Last active
October 27, 2015 16:06
-
-
Save airspeed/bdbf1d7419d0cd1b7c19 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
q = Source.where( :code => 'telekom_mega_deal' ).last | |
gs = Voucher.where( :source_id => q.id ) # Deal2015 | |
ios = Order.where( :state => :printed.to_s, :voucher_id => gs, :client_id => 5 ).map( &:total_amount ).sum.to_f | |
android = Order.where( :state => :printed.to_s, :voucher_id => gs, :client_id => 4 ).map( &:total_amount ).sum.to_f | |
Order.where( :state => :printed.to_s, :voucher_id => gs, :client_id => 5 ).count | |
Order.where( :state => :printed.to_s, :voucher_id => gs ).select{ | w | w.user.orders.where( :state => :printed.to_s ).first.id == w.id if w.user | |
}.select{ | w | w.user.mobile_operator_id == 1 }.count | |
Order.where( :state => :printed.to_s, :voucher_id => gs ).select{ | w | w.user.orders.where( :state => :printed.to_s ).first.id != w.id if w.user | |
}.select{ | w | w.user.mobile_operator_id != 1 }.count | |
Order.where( :state => :printed.to_s, :voucher_id => gs ).select{ | w | w.user.orders.where( :state => :printed.to_s ).first.id == w.id if w.user | |
}.select{ | w | CampaignUser.where( :user_id => w.user_id, :campaign_id => 1 ).count.nonzero? }.count | |
Order.where( :state => :printed.to_s, :voucher_id => gs ).select{ | w | w.user.orders.where( :state => :printed.to_s ).first.id != w.id if w.user | |
}.select{ | w | CampaignUser.where( :user_id => w.user_id, :campaign_id => 1 ).count.nonzero? }.count | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
kikel emelni, és lekel írni,,?