From ea8655a2117ef825f1a889f86b43177789936c2c Mon Sep 17 00:00:00 2001 From: tangjiang <465264938@qq.com> Date: Tue, 4 Feb 2020 14:04:03 +0800 Subject: [PATCH 1/8] update h5 style --- public/react/public/index.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/public/react/public/index.html b/public/react/public/index.html index de176398c..7da2b8d03 100755 --- a/public/react/public/index.html +++ b/public/react/public/index.html @@ -17,7 +17,7 @@ - + @@ -202,5 +202,11 @@ --> + + From 310da3e52cc5c319e2b9b7012eb4376ff486fbd5 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 4 Feb 2020 14:28:28 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=94=AF=E4=B8=80=E7=9A=84=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E4=BD=93=E7=B3=BB=E4=B8=8D=E6=88=90=E5=8A=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admins/subject_settings_controller.rb | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/app/controllers/admins/subject_settings_controller.rb b/app/controllers/admins/subject_settings_controller.rb index 903c5a458..29e4dfd30 100644 --- a/app/controllers/admins/subject_settings_controller.rb +++ b/app/controllers/admins/subject_settings_controller.rb @@ -8,16 +8,15 @@ class Admins::SubjectSettingsController < Admins::BaseController end def update - if params[:sub_disciplines] - sub_ids = params[:sub_disciplines].reject(&:blank?).map(&:to_i) - old_sub_ids = current_subject.sub_discipline_containers.pluck(:sub_discipline_id) - new_ids = sub_ids - old_sub_ids - delete_ids = old_sub_ids - sub_ids - sub_params = new_ids.map{|sub| {sub_discipline_id: sub}} - ActiveRecord::Base.transaction do - current_subject.sub_discipline_containers.where(sub_discipline_id: delete_ids).destroy_all - current_subject.sub_discipline_containers.create!(sub_params) - end + sub_discipline_ids = params[:sub_disciplines] || [] + sub_ids = sub_discipline_ids.reject(&:blank?).map(&:to_i) + old_sub_ids = current_subject.sub_discipline_containers.pluck(:sub_discipline_id) + new_ids = sub_ids - old_sub_ids + delete_ids = old_sub_ids - sub_ids + sub_params = new_ids.map{|sub| {sub_discipline_id: sub}} + ActiveRecord::Base.transaction do + current_subject.sub_discipline_containers.where(sub_discipline_id: delete_ids).destroy_all + current_subject.sub_discipline_containers.create!(sub_params) end end From 7e94a9fa096a34f6f3d61f6052e7593f05468ca8 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 4 Feb 2020 15:05:45 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E8=AF=BE=E5=A0=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 1864195f7..bb1c32864 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -1157,8 +1157,8 @@ class CoursesController < ApplicationController CourseAddStudentCreateWorksJob.perform_later(course.id, [current_user.id]) StudentJoinCourseNotifyJob.perform_later(current_user.id, course.id) + student_role = 1 end - student_role = 1 end # 创建教师身份 From 605285162440a4e9e1faaf8aa43d336fb3eeb32b Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 4 Feb 2020 15:13:48 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E5=AE=9E=E8=B7=B5=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E7=9A=84=E6=8E=A5=E5=8F=A3=E6=95=B0=E6=8D=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/weapps/subjects/index.json.jbuilder | 1 + app/views/weapps/subjects/show.json.jbuilder | 1 + 2 files changed, 2 insertions(+) diff --git a/app/views/weapps/subjects/index.json.jbuilder b/app/views/weapps/subjects/index.json.jbuilder index cfdce4530..fd12827b0 100644 --- a/app/views/weapps/subjects/index.json.jbuilder +++ b/app/views/weapps/subjects/index.json.jbuilder @@ -1,6 +1,7 @@ json.subjects @subjects do |subject| json.(subject, :id, :excellent, :name, :stages_count, :shixuns_count) json.myshixuns_count subject.member_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? end diff --git a/app/views/weapps/subjects/show.json.jbuilder b/app/views/weapps/subjects/show.json.jbuilder index 757257e82..29a30a89a 100644 --- a/app/views/weapps/subjects/show.json.jbuilder +++ b/app/views/weapps/subjects/show.json.jbuilder @@ -2,6 +2,7 @@ json.subject do json.name @subject.name json.description @subject.description json.shixuns_count @subject.shixuns_count + json.challenges_count @subject.subject_challenge_count json.member_count @subject.member_count json.subject_score @subject.all_score json.learning_notes @subject.learning_notes From da53ed2cbcc557ab3febda945549ae300663f56b Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 4 Feb 2020 15:19:46 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E5=AE=9E=E8=B7=B5=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E7=9A=84=E6=8E=A5=E5=8F=A3=E6=95=B0=E6=8D=AE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/weapps/subjects/index.json.jbuilder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/weapps/subjects/index.json.jbuilder b/app/views/weapps/subjects/index.json.jbuilder index fd12827b0..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.member_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? From 75615bc8586c4f4aa58b547202f7ee0a6f2600a5 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 4 Feb 2020 15:26:17 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E8=AF=BE=E5=A0=82?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index bb1c32864..9938c3b0b 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -1195,7 +1195,7 @@ class CoursesController < ApplicationController teacher_role = 1 end - if teacher_role && student_role + if (teacher_role && student_role) || message.to_s == "您已是课堂成员" render json: { status: 0, message: message, course_id: course.id} elsif student_role render json: { status: 0, message: "加入成功", course_id: course.id} From b34f3201c192d25ace19953403557a2dd3113ac0 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 4 Feb 2020 16:09:48 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E8=AF=BE=E5=A0=82?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 9938c3b0b..c946cd5c1 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -1197,7 +1197,7 @@ class CoursesController < ApplicationController if (teacher_role && student_role) || message.to_s == "您已是课堂成员" render json: { status: 0, message: message, course_id: course.id} - elsif student_role + elsif student_role.to_i == 1 render json: { status: 0, message: "加入成功", course_id: course.id} else normal_status(message) From 269e668c6192412e48b82298ca6ca8adb7b685e2 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 4 Feb 2020 16:54:18 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/weapps/subjects/index.json.jbuilder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/weapps/subjects/index.json.jbuilder b/app/views/weapps/subjects/index.json.jbuilder index 7e97f4562..8f61f150c 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.myshixuns_count + json.myshixuns_count subject.excellent ? subject.member_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?