Merge remote-tracking branch 'origin/dev_aliyun' into dev_aliyun

dev_cs
杨树林 5 years ago
commit 3193f9f4b4

@ -450,13 +450,13 @@ class SubjectsController < ApplicationController
@user_tags = []
else
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)
# 用户通关获得的标签
@user_tags = ChallengeTag.where(challenge_id: pass_challenge_ids).pluck(:name)
# 用户学习进度
@learned =
subject_challenge_count == 0 ? 0 :
((pass_challenge_ids.size.to_f / subject_challenge_count).round(2) * 100).to_i
@all_score == 0 ? 0 :
((pass_challenge_ids.size.to_f / @all_score).round(2) * 100).to_i
# 用户通关分数
@my_score = Challenge.where(id: pass_challenge_ids).size
@time = pass_games.map(&:cost_time).sum

@ -111,7 +111,7 @@ module CoursesHelper
when "announcement"
course.informs.count
when "online_learning"
course.subject&.shixuns_count
course.shixuns.count
end
end

@ -0,0 +1,7 @@
class MigrateGradeIndex < ActiveRecord::Migration[5.2]
def change
remove_index :grades, [:user_id, :container_id]
add_index :grades, [:container_id, :container_type]
add_index :grades, [:user_id]
end
end
Loading…
Cancel
Save