VRFS-1576 added block to referrals_by_date
This commit is contained in:
parent
c66f5879cf
commit
22566f1b29
|
|
@ -33,11 +33,12 @@ class JamRuby::AffiliatePartner < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def referrals_by_date
|
||||
User.where(:affiliate_referral_id => self.id)
|
||||
by_date = User.where(:affiliate_referral_id => self.id)
|
||||
.group('DATE(created_at)')
|
||||
.having("COUNT(*) > 0")
|
||||
.order('date_created_at DESC')
|
||||
.count
|
||||
block_given? ? yield(by_date) : by_date
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue