Tweaking main page stats to show member counts
This commit is contained in:
parent
7cd33ff030
commit
4da2ec9463
|
@ -5,7 +5,11 @@ def index
|
|||
@recent_certs = UserCertification.where("created_at > ?", DateTime.now - 7.days).count
|
||||
@num_users = User.count
|
||||
@recent_users = User.where("created_at > ?", DateTime.now - 7.days).count
|
||||
# Payments: member levels are multipled by 10 to indicate current payment; 25 x 10 = 250
|
||||
@num_paid_users = User.all.select{|u| u.member_status >= 250 }.count
|
||||
@num_plus_users = User.all.select{|u| u.member_status == 1000 }.count
|
||||
@num_basic_users = User.all.select{|u| u.member_status == 500 }.count
|
||||
@num_associate_users = User.all.select{|u| u.member_status == 250 }.count
|
||||
@num_delinquent_users = User.all.select{|u| !u.payment_status }.count
|
||||
if can? :read, User then
|
||||
@recent_user_names = User.where("member_level > 10").accessible_by(current_ability).order('created_at desc').limit(5)
|
||||
|
@ -14,7 +18,7 @@ def index
|
|||
@today_door_opens = DoorLog.where("key = 'G' AND created_at > ?", DateTime.now - 1.day).count
|
||||
@recent_door_opens = DoorLog.where("key = 'G' AND created_at > ?", DateTime.now - 7.days).count
|
||||
@num_door_denieds = DoorLog.where("key = 'D'").count
|
||||
@recent_door_denieds = DoorLog.where("key = 'D' AND created_at > ?", DateTime.now - 7.days).count
|
||||
@recent_door_denieds = DoorLog.where("key = 'D' AND created_at > ?", DateTime.now - 1.month).count
|
||||
@num_logins = User.sum('sign_in_count')
|
||||
@recent_logins = User.where('current_sign_in_at > ?',Date.today - 7.days).count
|
||||
@num_macs = Mac.count
|
||||
|
|
|
@ -30,12 +30,12 @@
|
|||
<dt># of People Certified:</dt>
|
||||
<dd><%= @num_certs %> (<%= @recent_certs %> new in the last 7 days)</dd>
|
||||
<dt># of Current Paying Members:</dt>
|
||||
<dd><%= @num_paid_users %> (<%= @num_delinquent_users %> not-current)</dd>
|
||||
<dd><%= @num_paid_users %> (<%= @num_plus_users %> plus, <%= @num_basic_users %> basic, <%= @num_associate_users %> associate. <%= @num_delinquent_users %> not-current)</dd>
|
||||
<dt># of Door Accesses Granted:</dt>
|
||||
<dd><%= @num_door_opens %> (<%= @today_door_opens %> today, <%= @recent_door_opens %> in the last 7 days)</dd>
|
||||
<dt># of Door Accesses Denied:</dt>
|
||||
<dd><%= @num_door_denieds %> (<%= @recent_door_denieds %> in the last 7 days)</dd>
|
||||
<dt># of Logins:</dt>
|
||||
<dd><%= @num_door_denieds %> (<%= @recent_door_denieds %> in the last month)</dd>
|
||||
<dt># of Members DB Logins:</dt>
|
||||
<dd><%= @num_logins %> (<%= @recent_logins %> users last 7 days)</dd>
|
||||
<dt># of Computers in this DB:</dt>
|
||||
<dd><%= @num_macs %> (<%= @recent_macs %> seen today)</dd>
|
||||
|
|
Loading…
Reference in New Issue
Block a user