|
|
@ -441,6 +441,7 @@ class SubjectsController < ApplicationController
|
|
|
|
def user_subject_progress challenge_ids
|
|
|
|
def user_subject_progress challenge_ids
|
|
|
|
pass_games = Game.select(:id, :cost_time, :challenge_id).where(status: 2, user_id: current_user.id, challenge_id: challenge_ids) if current_user.logged?
|
|
|
|
pass_games = Game.select(:id, :cost_time, :challenge_id).where(status: 2, user_id: current_user.id, challenge_id: challenge_ids) if current_user.logged?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@all_score = Challenge.where(id: challenge_ids).size
|
|
|
|
# 如果没有通关的,没必要再继续统计了
|
|
|
|
# 如果没有通关的,没必要再继续统计了
|
|
|
|
if pass_games.blank?
|
|
|
|
if pass_games.blank?
|
|
|
|
@my_score = 0
|
|
|
|
@my_score = 0
|
|
|
@ -448,7 +449,6 @@ class SubjectsController < ApplicationController
|
|
|
|
@time = 0
|
|
|
|
@time = 0
|
|
|
|
@user_tags = []
|
|
|
|
@user_tags = []
|
|
|
|
else
|
|
|
|
else
|
|
|
|
@all_score = Challenge.where(id: challenge_ids).size
|
|
|
|
|
|
|
|
pass_challenge_ids = pass_games.map(&:challenge_id).uniq # 按道理是不用去重的,但是历史数据与重复
|
|
|
|
pass_challenge_ids = pass_games.map(&:challenge_id).uniq # 按道理是不用去重的,但是历史数据与重复
|
|
|
|
subject_challenge_count = @subject.shixuns.sum(:challenges_count)
|
|
|
|
subject_challenge_count = @subject.shixuns.sum(:challenges_count)
|
|
|
|
# 用户通关获得的标签
|
|
|
|
# 用户通关获得的标签
|
|
|
|