Adding recent users report
This commit is contained in:
parent
8820dc4986
commit
c61b8ac8d4
|
@ -40,7 +40,8 @@ class UsersController < ApplicationController
|
||||||
|
|
||||||
# Recent user activity
|
# Recent user activity
|
||||||
def activity
|
def activity
|
||||||
@users = User.where(:last_sign_in_at => 1.month.ago..Date.today)
|
@user_logins = User.where(:last_sign_in_at => 1.month.ago..Date.today)
|
||||||
|
@new_users = User.where(:created_at => 3.months.ago..Date.today)
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /users/1
|
# GET /users/1
|
||||||
|
|
|
@ -1,18 +1,62 @@
|
||||||
<h1>Recent User Activity</h1>
|
<h1>Recent User Activity</h1>
|
||||||
|
|
||||||
|
<h2>New Users</h2>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Member Level</th>
|
||||||
|
<th>Account Created</th>
|
||||||
|
<th>Waiver</th>
|
||||||
|
<th>Orientation</th>
|
||||||
|
<th>Payment</th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<% if !@new_users.blank? %>
|
||||||
|
<% @new_users.sort_by(&:created_at).reverse!.each do |user| %>
|
||||||
|
<tr<%= " class='hidden'" if user.hidden? %>>
|
||||||
|
<td><%= link_to user.name, user %></td>
|
||||||
|
<td><%= user.member_level_string %></td>
|
||||||
|
<td><% if user.created_at.present? %>
|
||||||
|
<%= distance_of_time_in_words(DateTime.now, user.created_at.to_date)+" ago" %>
|
||||||
|
<% else %>
|
||||||
|
<span class="alert">×</span>
|
||||||
|
<% end %></td>
|
||||||
|
<td><% if user.waiver.present? %>
|
||||||
|
<%= distance_of_time_in_words(DateTime.now, user.waiver.to_date)+" ago" %>
|
||||||
|
<% else %>
|
||||||
|
<span class="alert">×</span>
|
||||||
|
<% end %></td>
|
||||||
|
<td><% if user.orientation.present? %>
|
||||||
|
<%= distance_of_time_in_words(DateTime.now, user.orientation.to_date)+" ago" %>
|
||||||
|
<% else %>
|
||||||
|
<span class="alert">×</span>
|
||||||
|
<% end %></td>
|
||||||
|
<td><% if user.payments.present? %>
|
||||||
|
<%= distance_of_time_in_words(Date.today, user.payments.maximum(:date))+" ago" %>
|
||||||
|
<% else %>
|
||||||
|
<span class="alert">×</span>
|
||||||
|
<% end %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<h2>Logins</h2>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
<th>Current Sign In</th>
|
<th>Current Sign In</th>
|
||||||
<th>Last Sign In</th>
|
<th>Last Sign In</th>
|
||||||
<th>Sign In Count</th>
|
<th>Sign In Count</th>
|
||||||
<th>Name</th>
|
|
||||||
<th>Account Created</th>
|
<th>Account Created</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<% if !@users.blank? %>
|
<% if !@user_logins.blank? %>
|
||||||
<% @users.sort_by(&:current_sign_in_at).reverse!.each do |user| %>
|
<% @user_logins.sort_by(&:current_sign_in_at).reverse!.each do |user| %>
|
||||||
<tr<%= " class='hidden'" if user.hidden? %>>
|
<tr<%= " class='hidden'" if user.hidden? %>>
|
||||||
|
<td><%= link_to user.name, user %></td>
|
||||||
<td><%= distance_of_time_in_words DateTime.now, user.current_sign_in_at %> ago</td>
|
<td><%= distance_of_time_in_words DateTime.now, user.current_sign_in_at %> ago</td>
|
||||||
<td>
|
<td>
|
||||||
<% if user.last_sign_in_at != user.current_sign_in_at %>
|
<% if user.last_sign_in_at != user.current_sign_in_at %>
|
||||||
|
@ -20,9 +64,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
<td><%= user.sign_in_count %> times</td>
|
<td><%= user.sign_in_count %> times</td>
|
||||||
<td><%= link_to user.name, user %></td>
|
|
||||||
<td><%= distance_of_time_in_words DateTime.now, user.created_at %> ago</td>
|
<td><%= distance_of_time_in_words DateTime.now, user.created_at %> ago</td>
|
||||||
<td><%= link_to 'Edit', edit_user_path(user) if can? :update, user %></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user