From fce8166ba7f082c4e4cd0fa3c2adc0dfe7a0d280 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cxxq250=E2=80=9D?= <“xxq250@qq.com”> Date: Mon, 26 Sep 2022 16:11:34 +0800 Subject: [PATCH] =?UTF-8?q?fixed=20=E7=94=A8=E6=88=B7=E6=B4=BB=E8=B7=83?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admins/dashboards_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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