From 9ad96e39cb96cb402495bcec956caf0e45c073f9 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 27 Sep 2019 16:34:29 +0800 Subject: [PATCH 1/6] =?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/services/subject_search_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/subject_search_service.rb b/app/services/subject_search_service.rb index 2366cecc2..f69c56c88 100644 --- a/app/services/subject_search_service.rb +++ b/app/services/subject_search_service.rb @@ -12,7 +12,7 @@ class SubjectSearchService < ApplicationService type = params[:type] || "all" if type == "mine" - @subjects = User.current.shixuns.visible.unhidden + @subjects = User.current.subjects.visible.unhidden else @subjects = Subject.visible.unhidden end From fbb033a0a23d6f7e3c5a8256f9290b01135e5cda Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 27 Sep 2019 16:36:09 +0800 Subject: [PATCH 2/6] =?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/decorators/tiding_decorator.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/decorators/tiding_decorator.rb b/app/decorators/tiding_decorator.rb index 4003ffb94..130e7f4b8 100644 --- a/app/decorators/tiding_decorator.rb +++ b/app/decorators/tiding_decorator.rb @@ -344,7 +344,7 @@ module TidingDecorator end def resubmit_student_work_content - I18n.t(locale_format) % container&.homework_common.try(:name) + I18n.t(locale_format) % parent_container.try(:name) end def student_works_score_content From acde3709b27bb9fa0d0f7c322012879be2b3060b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 27 Sep 2019 16:52:09 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/message/js/MessagSub.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/message/js/MessagSub.js b/public/react/src/modules/message/js/MessagSub.js index 88613513c..f9da5ea9d 100644 --- a/public/react/src/modules/message/js/MessagSub.js +++ b/public/react/src/modules/message/js/MessagSub.js @@ -488,7 +488,14 @@ class MessagSub extends Component { case "SubjectStartCourse": return window.open(`/paths/${item.container_id}`); case "ResubmitStudentWork": - return window.open(`/courses/${item.belong_container_id}/graduation_tasks/${item.container_id}/appraise`); + if (item.homework_type === "normal") { + //普通作业 + return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.parent_container_id}/${item.container_id}/appraise`); + } + if (item.homework_type === "group") { + //分组作业 + return window.open(`/courses/${item.belong_container_id}/group_homeworks/${item.parent_container_id}/${item.container_id}/appraise`); + } case "AdjustScore": //belong_container_id course的id return window.open(`/courses/${item.belong_container_id}/graduation_tasks/${item.parent_container_id}`); From ac07bb24aa7fbe2a754dfd32f8b635d673ad7e7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 27 Sep 2019 16:53:33 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/message/js/MessagSub.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/message/js/MessagSub.js b/public/react/src/modules/message/js/MessagSub.js index f9da5ea9d..f92ea71c4 100644 --- a/public/react/src/modules/message/js/MessagSub.js +++ b/public/react/src/modules/message/js/MessagSub.js @@ -498,7 +498,14 @@ class MessagSub extends Component { } case "AdjustScore": //belong_container_id course的id - return window.open(`/courses/${item.belong_container_id}/graduation_tasks/${item.parent_container_id}`); + if (item.homework_type === "normal") { + //普通作业 + return window.open(`/courses/${item.belong_container_id}/common_homeworks/${item.parent_container_id}`); + } + if (item.homework_type === "group") { + //分组作业 + return window.open(`/courses/${item.belong_container_id}/group_homeworks/${item.parent_container_id}`); + } default : return } From 8cf5da79fb5124a11ecb56f3457e66bc3e658b17 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Fri, 27 Sep 2019 17:07:08 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E5=9B=9E=E7=AD=94?= =?UTF-8?q?=E7=9A=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercise_answers_controller.rb | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/app/controllers/exercise_answers_controller.rb b/app/controllers/exercise_answers_controller.rb index e5d67b2d7..b1e23071b 100644 --- a/app/controllers/exercise_answers_controller.rb +++ b/app/controllers/exercise_answers_controller.rb @@ -14,19 +14,15 @@ class ExerciseAnswersController < ApplicationController else ea = @exercise_question.exercise_answers.search_answer_users("user_id",current_user.id) #试卷的当前用户的答案 if q_type == Exercise::SINGLE || q_type == Exercise::JUDGMENT #选择题(单选)/判断题 - ea_choice = ea.search_exercise_answer("exercise_choice_id",choice_id).first - answer_option = { + if ea.exists? + ea.first.update_attribute(:exercise_choice_id,choice_id ) + else + answer_option = { :user_id => current_user.id, :exercise_question_id => @exercise_question.id, :exercise_choice_id => choice_id, :answer_text => "" - } - if ea_choice.present? #如果当前用户的答案存在,再次点击,即为删除 - ea_choice.destroy - else - if @exercise_question.exercise_standard_answers.count <= 1 #单选题的时候 - ea.first.destroy if ea.present? - end + } ex_a = ExerciseAnswer.new(answer_option) ex_a.save! end From 8cc30ccd52dbd001bb23ed5530563b8d324ecec1 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 27 Sep 2019 17:10:32 +0800 Subject: [PATCH 6/6] =?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/shixun_lists/index.json.jbuilder | 6 +++--- app/views/subject_lists/index.json.jbuilder | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/views/shixun_lists/index.json.jbuilder b/app/views/shixun_lists/index.json.jbuilder index 79ce4b09c..08baeabf9 100644 --- a/app/views/shixun_lists/index.json.jbuilder +++ b/app/views/shixun_lists/index.json.jbuilder @@ -11,12 +11,12 @@ json.shixun_list do atta_reg = /!\[.*]\(\/api\/attachments\/\d+\)/ highlights[:description]&.first&.sub!(reg, '') - highlights[:description]&.map{|des| des.gsub!(atta_reg, '')} + highlights[:description]&.map{|des| des.gsub(atta_reg, '')} highlights[:content]&.first&.sub!(reg, '') - highlights[:content]&.map{|des| des.gsub!(atta_reg, '')} + highlights[:content]&.map{|des| des.gsub(atta_reg, '')} json.title highlights.delete(:name)&.join('...') || obj.searchable_title - json.description highlights[:description]&.join('...') || Util.extract_content(obj.description)[0..300]&.sub!(atta_reg, '') + json.description highlights[:description]&.join('...') || Util.extract_content(obj.description)[0..300]&.gsub(atta_reg, '') json.content highlights json.level level_to_s(obj.trainee) diff --git a/app/views/subject_lists/index.json.jbuilder b/app/views/subject_lists/index.json.jbuilder index 6992deb1f..63ee6dcbc 100644 --- a/app/views/subject_lists/index.json.jbuilder +++ b/app/views/subject_lists/index.json.jbuilder @@ -7,15 +7,15 @@ json.subject_list do # 去除开头标点符号 reg = /^[,。?:;‘’!“”—……、]/ # 附件的替换 - atta_reg = /!\[.*]\(\/api\/attachments\/\d+\)/ + atta_reg = /!\[.*\]\(\/api\/attachments\/\d+\)/ highlights[:description]&.first&.sub!(reg, '') - highlights[:description]&.map{|des| des.gsub!(atta_reg, '')} + highlights[:description]&.map{|des| des.gsub(atta_reg, '')} highlights[:content]&.first&.sub!(reg, '') - highlights[:content]&.map{|des| des.gsub!(atta_reg, '')} + highlights[:content]&.map{|des| des.gsub(atta_reg, '')} json.title highlights.delete(:name)&.join('...') || obj.searchable_title - json.description highlights[:description]&.join('...') || Util.extract_content(obj.description)[0..300]&.sub!(atta_reg, '') + json.description highlights[:description]&.join('...') || Util.extract_content(obj.description)[0..300]&.gsub(atta_reg, '') json.content highlights end