Adding zombie report

This commit is contained in:
Will Bradley 2013-10-06 05:17:24 -07:00
parent 57e6ac1fc5
commit 15836b4f4e
2 changed files with 26 additions and 2 deletions

View File

@ -50,7 +50,8 @@ class UsersController < ApplicationController
# Recent user activity # Recent user activity
def activity def activity
@user_logins = User.where(:last_sign_in_at => 1.month.ago..Time.now) @zombie_members = User.where('sign_in_count = 0').where('member_level > 1')
@user_logins = User.where(:current_sign_in_at => 2.months.ago..Time.now).where('sign_in_count > 1')
@new_users = User.where(:created_at => 3.months.ago..Date.today) @new_users = User.where(:created_at => 3.months.ago..Date.today)
@cardless_users = User.includes('cards').where(['users.member_level >= ?','50']).where('cards.id IS NULL') @cardless_users = User.includes('cards').where(['users.member_level >= ?','50']).where('cards.id IS NULL')
end end

View File

@ -1,7 +1,8 @@
<h1>Member Onboarding/Activity</h1> <h1>Member Onboarding/Activity</h1>
<a href="#new_users">New Users</a> | <a href="#new_users">New Users</a> |
<a href="#members_without_cards">Members Without Cards</a> | <a href="#members_without_cards">Members Without Cards</a> |
<a href="#logins">Logins</a> <a href="#logins">Logins</a> |
<a href="#zombies">Never-Logged-In Members</a>
<h2><a name="new_users"></a>New Users</h2> <h2><a name="new_users"></a>New Users</h2>
@ -114,3 +115,25 @@
<% end %> <% end %>
</table> </table>
<h2><a name="zombies"></a>Never-Logged-In Members</h2>
<em>Excluding non-members</em>
<table>
<tr>
<th>Name</th>
<th>Member Level</th>
<th>Account Created</th>
<th></th>
</tr>
<% if !@zombie_members.blank? %>
<% @zombie_members.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><%= distance_of_time_in_words DateTime.now, user.created_at %> ago</td>
</tr>
<% end %>
<% end %>
</table>