Updating homepage to display cooler door/mac stats
This commit is contained in:
parent
2d0735e914
commit
f1b752a4c4
|
@ -5,10 +5,16 @@ def index
|
||||||
@recent_certs = UserCertification.where("created_at > ?", DateTime.now - 7.days).count
|
@recent_certs = UserCertification.where("created_at > ?", DateTime.now - 7.days).count
|
||||||
@num_users = User.count
|
@num_users = User.count
|
||||||
@recent_users = User.where("created_at > ?", DateTime.now - 7.days).count
|
@recent_users = User.where("created_at > ?", DateTime.now - 7.days).count
|
||||||
|
if can? :read, User then
|
||||||
|
@recent_user_names = User.where("created_at > ?", DateTime.now - 7.days)
|
||||||
|
end
|
||||||
@num_door_opens = DoorLog.where("key = 'G'").count
|
@num_door_opens = DoorLog.where("key = 'G'").count
|
||||||
|
@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
|
@recent_door_opens = DoorLog.where("key = 'G' AND created_at > ?", DateTime.now - 7.days).count
|
||||||
@num_door_denieds = DoorLog.where("key = 'D'").count
|
@num_door_denieds = DoorLog.where("key = 'f'").count
|
||||||
@recent_door_denieds = DoorLog.where("key = 'D' AND created_at > ?", DateTime.now - 7.days).count
|
@recent_door_denieds = DoorLog.where("key = 'f' AND created_at > ?", DateTime.now - 7.days).count
|
||||||
|
@num_macs = Mac.count
|
||||||
|
@recent_macs = Mac.where("since > ?", DateTime.now - 1.day).count
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html # index.html.erb
|
format.html # index.html.erb
|
||||||
|
|
|
@ -7,14 +7,24 @@
|
||||||
<% if user_signed_in? && current_user.member.to_i < current_user.member_level.to_i then %>
|
<% if user_signed_in? && current_user.member.to_i < current_user.member_level.to_i then %>
|
||||||
<p class="alert">Looks like we haven't acknowledged a recent payment for you yet. This could be because we're slow, or this app just got started, but if in doubt please see your profile for payment instructions, or consider updating your membership level to something accurate.<br/>Thanks for supporting HeatSync!</p>
|
<p class="alert">Looks like we haven't acknowledged a recent payment for you yet. This could be because we're slow, or this app just got started, but if in doubt please see your profile for payment instructions, or consider updating your membership level to something accurate.<br/>Thanks for supporting HeatSync!</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% if ((can? :read, User) && (@recent_user_names.count > 1)) then %>
|
||||||
|
<h2>New People:</h2>
|
||||||
|
<ul>
|
||||||
|
<% @recent_user_names.each do |user| %>
|
||||||
|
<li><%= link_to user.name, user %></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<% end %>
|
||||||
<h2>Cool Stats:</h2>
|
<h2>Cool Stats:</h2>
|
||||||
<dl>
|
<dl>
|
||||||
<dt># of People in this DB:</dt>
|
<dt># of People in this DB:</dt>
|
||||||
<dd><%= @num_users %> (<%= @recent_users %> in the last 7 days)</dd>
|
<dd><%= @num_users %> (<%= @recent_users %> new in the last 7 days)</dd>
|
||||||
<dt># of People Certified:</dt>
|
<dt># of People Certified:</dt>
|
||||||
<dd><%= @num_certs %> (<%= @recent_certs %> in the last 7 days)</dd>
|
<dd><%= @num_certs %> (<%= @recent_certs %> new in the last 7 days)</dd>
|
||||||
<dt># of Door Accesses Granted:</dt>
|
<dt># of Door Accesses Granted:</dt>
|
||||||
<dd><%= @num_door_opens %> (<%= @recent_door_opens %> in the last 7 days)</dd>
|
<dd><%= @num_door_opens %> (<%= @today_door_opens %> today, <%= @recent_door_opens %> in the last 7 days)</dd>
|
||||||
<dt># of Door Accesses Denied:</dt>
|
<dt># of Door Accesses Denied:</dt>
|
||||||
<dd><%= @num_door_denieds %> (<%= @recent_door_denieds %> in the last 7 days)</dd>
|
<dd><%= @num_door_denieds %> (<%= @recent_door_denieds %> in the last 7 days)</dd>
|
||||||
|
<dt># of Computers in this DB:</dt>
|
||||||
|
<dd><%= @num_macs %> (<%= @recent_macs %> seen today)</dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user