小程序的详情页取实训人数

Adjustreact
cxt 5 years ago
parent 19e9fdfc69
commit f9fc7f3eef

@ -65,6 +65,10 @@ class Subject < ApplicationRecord
excellent ? CourseMember.where(role: 4, course_id: courses.pluck(:id)).pluck(:user_id).length : shixuns.pluck(:myshixuns_count).sum
end
def myshixuns_count
shixuns.pluck(:myshixuns_count).sum
end
def all_score
subject_shixun_score + subject_shixun_choose_score
end

@ -3,7 +3,7 @@ json.subject do
json.description @subject.description
json.shixuns_count @subject.shixuns_count
json.challenges_count @subject.subject_challenge_count
json.member_count @subject.member_count
json.member_count @subject.myshixuns_count
json.subject_score @subject.all_score
json.learning_notes @subject.learning_notes
end

Loading…
Cancel
Save