From b386dc51e4bed47a1fd308d206704634cc9c3555 Mon Sep 17 00:00:00 2001 From: xiaoxiaoqiong Date: Tue, 19 Jul 2022 14:56:02 +0800 Subject: [PATCH] =?UTF-8?q?fixed=20=E5=90=8E=E5=8F=B0=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E4=BC=98=E5=8C=96,7=E5=A4=A9=E6=97=B6=E9=97=B4=E7=B2=BE?= =?UTF-8?q?=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admins/dashboards_controller.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controllers/admins/dashboards_controller.rb b/app/controllers/admins/dashboards_controller.rb index 5ac1508d1..fac44cca9 100644 --- a/app/controllers/admins/dashboards_controller.rb +++ b/app/controllers/admins/dashboards_controller.rb @@ -17,9 +17,9 @@ class Admins::DashboardsController < Admins::BaseController @month_new_user_count = User.where(created_on: current_month).count # 活跃项目数 - day_project_ids = CommitLog.where(created_at: today).pluck(:project_id).uniq - weekly_project_ids = CommitLog.where(created_at: current_week).pluck(:project_id).uniq - month_project_ids = CommitLog.where(created_at: current_month).pluck(:project_id).uniq + day_project_ids = (CommitLog.where(created_at: today).pluck(:project_id).uniq + Issue.where(created_on: today).pluck(:project_id).uniq).uniq + weekly_project_ids = (CommitLog.where(created_at: current_week).pluck(:project_id).uniq + Issue.where(created_on: current_week).pluck(:project_id).uniq).uniq + month_project_ids = (CommitLog.where(created_at: current_month).pluck(:project_id).uniq + Issue.where(created_on: current_month).pluck(:project_id).uniq).uniq @day_active_project_count = Project.where(updated_on: today).or(Project.where(id: day_project_ids)).count @weekly_active_project_count = Project.where(updated_on: current_week).or(Project.where(id: weekly_project_ids)).count @month_active_project_count = Project.where(updated_on: current_month).or(Project.where(id: month_project_ids)).count @@ -65,14 +65,14 @@ class Admins::DashboardsController < Admins::BaseController end def current_week - 7.days.ago.beginning_of_day..Time.now.end_of_day + 7.days.ago.end_of_day..Time.now.end_of_day end def current_month - 30.days.ago.beginning_of_day..Time.now.end_of_day + 30.days.ago.end_of_day..Time.now.end_of_day end def pre_week - 14.days.ago.beginning_of_day..7.days.ago.beginning_of_day + 14.days.ago.end_of_day..7.days.ago.end_of_day end end \ No newline at end of file