admins use statistic: reduce sql time

dev_auth
p31729568 5 years ago
parent 1a565231e4
commit a237c2f901

@ -46,12 +46,12 @@ class Admins::UserStatisticQuery < ApplicationQuery
finish_challenge = finish_challenge.where(updated_at: time_range)
end
study_myshixun_map = study_myshixun.group(:user_id).count
finish_myshixun_map = finish_myshixun.group(:user_id).count
study_challenge_map = study_challenge.group(:user_id).count
finish_challenge_map = finish_challenge.group(:user_id).count
evaluate_count_map = study_challenge.group(:user_id).sum(:evaluate_count)
cost_time_map = study_challenge.group(:user_id).sum(:cost_time)
study_myshixun_map = study_myshixun.reorder(nil).group(:user_id).count
finish_myshixun_map = finish_myshixun.reorder(nil).group(:user_id).count
study_challenge_map = study_challenge.reorder(nil).group(:user_id).count
finish_challenge_map = finish_challenge.reorder(nil).group(:user_id).count
evaluate_count_map = study_challenge.reorder(nil).group(:user_id).sum(:evaluate_count)
cost_time_map = study_challenge.reorder(nil).group(:user_id).sum(:cost_time)
users.each do |user|
user._extra_data = {

Loading…
Cancel
Save