diff --git a/app/controllers/admins/dashboards_controller.rb b/app/controllers/admins/dashboards_controller.rb index fac44cca9..a3fc230ad 100644 --- a/app/controllers/admins/dashboards_controller.rb +++ b/app/controllers/admins/dashboards_controller.rb @@ -1,9 +1,9 @@ class Admins::DashboardsController < Admins::BaseController def index # 用户活跃数 - day_user_ids = CommitLog.where(created_at: today).pluck(:project_id).uniq - weekly_user_ids = CommitLog.where(created_at: current_week).pluck(:project_id).uniq - month_user_ids = CommitLog.where(created_at: current_month).pluck(:project_id).uniq + day_user_ids = CommitLog.where(created_at: today).pluck(:user_id).uniq + weekly_user_ids = CommitLog.where(created_at: current_week).pluck(:user_id).uniq + month_user_ids = CommitLog.where(created_at: current_month).pluck(:user_id).uniq @active_user_count = User.where(last_login_on: today).or(User.where(id: day_user_ids)).count @weekly_active_user_count = User.where(last_login_on: current_week).or(User.where(id: weekly_user_ids)).count @month_active_user_count = User.where(last_login_on: current_month).or(User.where(id: month_user_ids)).count