diff --git a/app/models/subject.rb b/app/models/subject.rb index fc43cfb11..99ba4b72b 100644 --- a/app/models/subject.rb +++ b/app/models/subject.rb @@ -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 diff --git a/app/views/weapps/subjects/show.json.jbuilder b/app/views/weapps/subjects/show.json.jbuilder index 29a30a89a..476e3e797 100644 --- a/app/views/weapps/subjects/show.json.jbuilder +++ b/app/views/weapps/subjects/show.json.jbuilder @@ -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