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/index.json.jbuilder b/app/views/weapps/subjects/index.json.jbuilder index 8f61f150c..7e97f4562 100644 --- a/app/views/weapps/subjects/index.json.jbuilder +++ b/app/views/weapps/subjects/index.json.jbuilder @@ -1,6 +1,6 @@ json.subjects @subjects do |subject| json.(subject, :id, :excellent, :name, :stages_count, :shixuns_count) - json.myshixuns_count subject.excellent ? subject.member_count : subject.myshixuns_count + json.myshixuns_count subject.myshixuns_count json.challenges_count subject.subject_challenge_count json.image_url url_to_avatar(subject) json.allow_visit subject.status > 1 || User.current.manager_of_subject?(subject) || User.current.admin? 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 diff --git a/public/react/src/modules/paths/statics/index.js b/public/react/src/modules/paths/statics/index.js index 46689311d..b10809f99 100644 --- a/public/react/src/modules/paths/statics/index.js +++ b/public/react/src/modules/paths/statics/index.js @@ -247,7 +247,7 @@ const App = (props) => {
学习统计 - Android综合实训之物联网移动应用 +