Browse Source

fixed 用户活跃数

pull/312/head
“xxq250” 3 years ago
parent
commit
3ba7114d08
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      app/controllers/admins/dashboards_controller.rb

+ 3
- 3
app/controllers/admins/dashboards_controller.rb View File

@@ -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


Loading…
Cancel
Save