added 'last login' report
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
class ReportsController < ApplicationController
|
||||
before_filter :authenticate_user!
|
||||
|
||||
layout "report", except: [:statistics_global_activity, :statistics_inactive_users, :statistics_demographics]
|
||||
layout "report", except: [:statistics_global_activity, :statistics_inactive_users, :statistics_demographics, :statistics_last_login]
|
||||
|
||||
def user_list
|
||||
@members = current_organization.members.includes(:user).order("members.member_uid")
|
||||
@ -67,5 +67,9 @@ class ReportsController < ApplicationController
|
||||
def statistics_demographics
|
||||
@members = current_organization.members
|
||||
end
|
||||
|
||||
def statistics_last_login
|
||||
@members = current_organization.members.sort_by{|m| m.user.last_sign_in_at.present? ? m.user.last_sign_in_at.to_date : DateTime.now.to_date - 20.years}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
15
app/views/reports/statistics_last_login.html.haml
Normal file
15
app/views/reports/statistics_last_login.html.haml
Normal file
@ -0,0 +1,15 @@
|
||||
%h1= t("global.statistics") + ": " + t(".last_login")
|
||||
.panel.panel-default
|
||||
.panel-body
|
||||
%table.table.table-hover.table-condensed
|
||||
%thead
|
||||
%tr
|
||||
%th ID
|
||||
%th= User.human_attribute_name(:username)
|
||||
%th= User.human_attribute_name(:last_sign_in_at)
|
||||
%tbody
|
||||
- @members.each do |mem|
|
||||
%tr
|
||||
%td= mem.member_uid
|
||||
%td= link_to mem.user.username, mem.user
|
||||
%td= mem.user.last_sign_in_at.blank? ? t(".never_login") : l(mem.user.last_sign_in_at, format: :short)
|
||||
@ -51,6 +51,7 @@ es:
|
||||
alt_phone: Teléfono alternativo
|
||||
admin: Administrador de organización
|
||||
superadmin: Administrador de sistema
|
||||
last_sign_in_at: Fecha último login
|
||||
organization:
|
||||
<<: *common_attributes
|
||||
name: Nombre
|
||||
@ -98,6 +99,7 @@ es:
|
||||
global_activity: "Actividad global"
|
||||
inactive_users: Usuarios inactivos
|
||||
demographics: Datos demográficos
|
||||
last_login: Último login
|
||||
|
||||
# views/users/index...
|
||||
|
||||
@ -171,6 +173,9 @@ es:
|
||||
demographics: Datos demográficos
|
||||
by_ages: Por edades
|
||||
by_gender: Por género
|
||||
statistics_last_login:
|
||||
last_login: Último login
|
||||
never_login: Nunca logueado
|
||||
|
||||
stats:
|
||||
min_balance:
|
||||
|
||||
@ -41,6 +41,7 @@ Timeoverflow::Application.routes.draw do
|
||||
get "statistics_global_activity"
|
||||
get "statistics_inactive_users"
|
||||
get "statistics_demographics"
|
||||
get "statistics_last_login"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user