You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
673 B
14 lines
673 B
class Admins::MyshixunsController < Admins::BaseController
|
|
def index
|
|
params[:sort_by] = params[:sort_by].presence || 'created_at'
|
|
params[:sort_direction] = params[:sort_direction].presence || 'desc'
|
|
|
|
myshixuns = Admins::MyshixunQuery.call(params)
|
|
|
|
@myshixuns = paginate myshixuns.includes(:last_executable_task, :last_task, shixun: :user, user: { user_extension: :school })
|
|
|
|
myshixun_ids = @myshixuns.map(&:id)
|
|
@finish_game_count = Game.where(myshixun_id: myshixun_ids, status: 2).group(:myshixun_id).count
|
|
@total_score = Game.where(myshixun_id: myshixun_ids, status: 2).where('final_score > 0').group(:myshixun_id).sum(:final_score)
|
|
end
|
|
end |