* show daily status
This commit is contained in:
parent
2b81276e1b
commit
5073c2d4e7
|
|
@ -0,0 +1,36 @@
|
|||
ActiveAdmin.register JamRuby::AffiliateTrafficTotal, :as => 'Affiliate Daily Stats' do
|
||||
|
||||
menu :label => 'Daily Stats', :parent => 'Affiliates'
|
||||
|
||||
config.sort_order = 'referral_user_count DESC'
|
||||
config.batch_actions = false
|
||||
config.clear_action_items!
|
||||
config.filters = true
|
||||
config.per_page = 50
|
||||
config.paginate = true
|
||||
|
||||
filter :affiliate_partner
|
||||
filter :day
|
||||
filter :signups
|
||||
filter :visits
|
||||
|
||||
form :partial => 'form'
|
||||
|
||||
scope("Active", default: true) { |scope| scope.where('visits != 0 or signups != 0').order('day desc') }
|
||||
|
||||
index do
|
||||
|
||||
# default_actions # use this for all view/edit/delete links
|
||||
|
||||
column 'Day' do |oo| oo.day end
|
||||
column 'Partner' do |oo| link_to(oo.affiliate_partner, oo.affiliate_partner.admin_url, {:title => oo.affiliate_partner.display_name}) end
|
||||
column 'Signups' do |oo| oo.signups end
|
||||
column 'Visits' do |oo| oo.visits end
|
||||
|
||||
end
|
||||
|
||||
|
||||
controller do
|
||||
|
||||
end
|
||||
end
|
||||
|
|
@ -11,7 +11,7 @@ ActiveAdmin.register JamRuby::AffiliatePartner, :as => 'Affiliates' do
|
|||
|
||||
form :partial => 'form'
|
||||
|
||||
scope("Active", default: true) { |scope| scope.where('partner_user_id IS NOT NULL').order('') }
|
||||
scope("Active", default: true) { |scope| scope.where('partner_user_id IS NOT NULL').order('referral_user_count desc') }
|
||||
scope("Unpaid") { |partner| partner.unpaid }
|
||||
|
||||
index do
|
||||
|
|
|
|||
|
|
@ -54,6 +54,10 @@ class JamRuby::AffiliatePartner < ActiveRecord::Base
|
|||
partner_name || (partner_user ? partner_user.name : 'abandoned')
|
||||
end
|
||||
|
||||
def admin_url
|
||||
APP_CONFIG.admin_root_url + "/admin/affiliates/" + id
|
||||
end
|
||||
|
||||
# used by admin
|
||||
def self.create_with_params(params={})
|
||||
raise 'not supported'
|
||||
|
|
|
|||
Loading…
Reference in New Issue