From 8fb9847ff3c5c6b54beb6ba60dcc0bc3816696c8 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 31 Dec 2019 14:38:39 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E6=8E=92=E5=BA=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/discusses_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/discusses_controller.rb b/app/controllers/discusses_controller.rb index 6b21526dd..e7d692de5 100644 --- a/app/controllers/discusses_controller.rb +++ b/app/controllers/discusses_controller.rb @@ -14,14 +14,14 @@ class DiscussesController < ApplicationController @disscuss_count = Discuss.where(:dis_id => @container.id, :dis_type => @container.class.to_s, :root_id => nil).count disscusses = Discuss.where(:dis_id => @container.id, :dis_type => @container.class.to_s, :root_id => nil) - @discusses = disscusses.limit(LIMIT).joins("left join games on discusses.challenge_id = games.challenge_id and discusses.user_id = games.user_id") - .select("discusses.*, games.identifier").includes(:user, :praise_treads).offset(offset) + @discusses = disscusses.joins("left join games on discusses.challenge_id = games.challenge_id and discusses.user_id = games.user_id") + .select("discusses.*, games.identifier").includes(:user, :praise_treads) else disscusses = Discuss.where("dis_id = :dis_id and dis_type = :dis_type and root_id is null and (discusses.hidden = :hidden or discusses.user_id = :user_id)", {dis_id: @container.id, dis_type: @container.class.to_s, hidden: false, user_id: current_user.id}) @disscuss_count = disscusses.count("discusses.id") - @discusses = disscusses.limit(LIMIT).includes(:user, :praise_treads).offset(offset) + @discusses = disscusses.includes(:user, :praise_treads).limit(LIMIT).offset(offset) end @current_user = current_user From 928e5f010d7cef610f8aa173a589c6ca832247c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Tue, 31 Dec 2019 18:52:09 +0800 Subject: [PATCH 2/9] =?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/courses/poll/PollDetailTabForth.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/poll/PollDetailTabForth.js b/public/react/src/modules/courses/poll/PollDetailTabForth.js index 44a09adae..2625418ee 100644 --- a/public/react/src/modules/courses/poll/PollDetailTabForth.js +++ b/public/react/src/modules/courses/poll/PollDetailTabForth.js @@ -112,7 +112,7 @@ class PollDetailTabForth extends Component{ // 已有设置数据的查询 getSettingInfo=()=>{ - this.props.getPollInfo(); + // this.props.getPollInfo(); let pollId=this.props.match.params.pollId; let url=`/polls/${pollId}/poll_setting.json`; axios.get(url).then((result)=>{ @@ -197,6 +197,7 @@ class PollDetailTabForth extends Component{ this.props.form.validateFieldsAndScroll((err, values) => { if(!err){ + this.props.getPollInfo(); // 第一次进行问卷设置或者勾选了统一设置 let{unitSetting}=this.state if(unitSetting==true){ From f55e79aa1657abe6e4663e5e8ac00f7f34f3b011 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Tue, 31 Dec 2019 18:54:25 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/poll/PollDetailIndex.js | 19 ++++++++++++++++++- .../courses/poll/PollDetailTabForth.js | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/poll/PollDetailIndex.js b/public/react/src/modules/courses/poll/PollDetailIndex.js index 38cc3796e..d064fc284 100644 --- a/public/react/src/modules/courses/poll/PollDetailIndex.js +++ b/public/react/src/modules/courses/poll/PollDetailIndex.js @@ -68,6 +68,23 @@ class PollDetailIndex extends Component{ } } + newgetPollInfo=()=>{ + // console.log(this.props); + let pollId=this.props.match.params.pollId; + let url=`/polls/${pollId}/common_header.json` + axios.get(url).then((result)=>{ + if(result.status==200){ + this.setState({ + pollDetail:result.data, + user_permission:result.data.user_permission, + polls_status:result.data.polls_status, + }) + } + }).catch((error)=>{ + console.log(error); + }) + + } componentDidMount(){ const query =this.props.location.search; @@ -259,7 +276,7 @@ class PollDetailIndex extends Component{ } { //设置 - parseInt(tab[0])==3 && + parseInt(tab[0])==3 && } diff --git a/public/react/src/modules/courses/poll/PollDetailTabForth.js b/public/react/src/modules/courses/poll/PollDetailTabForth.js index 2625418ee..099abed0a 100644 --- a/public/react/src/modules/courses/poll/PollDetailTabForth.js +++ b/public/react/src/modules/courses/poll/PollDetailTabForth.js @@ -197,7 +197,7 @@ class PollDetailTabForth extends Component{ this.props.form.validateFieldsAndScroll((err, values) => { if(!err){ - this.props.getPollInfo(); + this.props.newgetPollInfo(); // 第一次进行问卷设置或者勾选了统一设置 let{unitSetting}=this.state if(unitSetting==true){ From 8da60f4fe4ca0f0e810434ec40f491b1a5decdd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Tue, 31 Dec 2019 18:55:00 +0800 Subject: [PATCH 4/9] . --- public/react/src/modules/courses/poll/PollDetailTabForth.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/poll/PollDetailTabForth.js b/public/react/src/modules/courses/poll/PollDetailTabForth.js index 099abed0a..f5c49f0fe 100644 --- a/public/react/src/modules/courses/poll/PollDetailTabForth.js +++ b/public/react/src/modules/courses/poll/PollDetailTabForth.js @@ -112,7 +112,7 @@ class PollDetailTabForth extends Component{ // 已有设置数据的查询 getSettingInfo=()=>{ - // this.props.getPollInfo(); + this.props.newgetPollInfo(); let pollId=this.props.match.params.pollId; let url=`/polls/${pollId}/poll_setting.json`; axios.get(url).then((result)=>{ @@ -197,7 +197,7 @@ class PollDetailTabForth extends Component{ this.props.form.validateFieldsAndScroll((err, values) => { if(!err){ - this.props.newgetPollInfo(); + // 第一次进行问卷设置或者勾选了统一设置 let{unitSetting}=this.state if(unitSetting==true){ From d7e3d8e1d8b9b292bd4ece3752791b9a1d98c82a Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 31 Dec 2019 19:04:16 +0800 Subject: [PATCH 5/9] =?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/homework_commons_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index e26e67a93..a4d34a1c8 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -1377,12 +1377,12 @@ class HomeworkCommonsController < ApplicationController tip_exception(-1, "作业还未发布,不能评阅") if @homework_detail_manual.comment_status == 0 tip_exception("请至少输入一个评阅") if params[:comment].blank? && params[:hidden_comment].blank? ActiveRecord::Base.transaction do - work_ids = @homework.student_works.where(user_id: @course.teacher_group_user_ids(current_user.id)).pluck(:id) + work_ids = @homework.student_works.where(work_status: [1, 2], user_id: @course.teacher_group_user_ids(current_user.id)).pluck(:id) has_comment_ids = ShixunWorkComment.where(challenge_id: 0, student_work_id: work_ids, batch_comment: 0).pluck(:student_work_id) batch_comment_works = ShixunWorkComment.where(challenge_id: 0, student_work_id: work_ids, batch_comment: 1) batch_comment_works.update_all(comment: params[:comment], hidden_comment: params[:hidden_comment]) work_ids = work_ids - has_comment_ids - batch_comment_works.pluck(:student_work_id) - @homework.student_works.where(work_status: 0, id: work_ids).update_all(work_status: 1, commit_time: @homework.end_time, update_time: Time.now, work_score: 0, final_score: 0) + # @homework.student_works.where(work_status: 0, id: work_ids).update_all(work_status: 1, commit_time: @homework.end_time, update_time: Time.now, work_score: 0, final_score: 0) HomeworkBatchCommentJob.perform_later(params[:comment], params[:hidden_comment], work_ids, @homework.id, current_user.id) normal_status("评阅成功") end From 979c05fd3b00de7940849647c4122e59974f1a3f Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 31 Dec 2019 19:16:43 +0800 Subject: [PATCH 6/9] =?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/polls_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index 08d0da42f..bfa96bccf 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -792,12 +792,12 @@ class PollsController < ApplicationController if the_group_setting_status == 2 poll_group_params = { :publish_time => the_group_setting.publish_time, - :end_time => poll_end_time + :end_time => poll_end_time < Time.now ? the_group_setting.end_time : poll_end_time } elsif the_group_setting_status == 3 poll_group_params = { :publish_time => the_group_setting.publish_time, - :end_time => the_group_setting.end_time + :end_time => exercise_end_time } end the_group_setting.update_attributes(poll_group_params) From c87e235e57fc3cef862859f71a1a18e39c00d7bb Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 31 Dec 2019 19:17:05 +0800 Subject: [PATCH 7/9] =?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/polls_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index bfa96bccf..3e6914dee 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -797,7 +797,7 @@ class PollsController < ApplicationController elsif the_group_setting_status == 3 poll_group_params = { :publish_time => the_group_setting.publish_time, - :end_time => exercise_end_time + :end_time => poll_end_time } end the_group_setting.update_attributes(poll_group_params) From b5984112a0de81471c70c12d1c01f61072b73333 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 1 Jan 2020 17:22:45 +0800 Subject: [PATCH 8/9] =?UTF-8?q?pdf=E5=AF=BC=E5=87=BA=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 64d03cbac..40c63caa6 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -25,7 +25,7 @@ class ApplicationController < ActionController::Base def check_sign Rails.logger.info("66666 #{params}") suffix = request.url.split(".").last - suffix_arr = ["xls", "xlsx"] # excel文件先注释 + suffix_arr = ["xls", "xlsx", "pdf"] # excel文件先注释 unless suffix_arr.include?(suffix) if params[:client_key].present? randomcode = params[:randomcode] From e6e0385e4c2f2ebe4bd6b94db874292148fa1988 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 1 Jan 2020 17:28:45 +0800 Subject: [PATCH 9/9] =?UTF-8?q?pdf=E5=AF=BC=E5=87=BA=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 40c63caa6..254d04cfd 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -24,7 +24,7 @@ class ApplicationController < ActionController::Base # 所有请求必须合法签名 def check_sign Rails.logger.info("66666 #{params}") - suffix = request.url.split(".").last + suffix = request.url.split(".").last.split("?").first suffix_arr = ["xls", "xlsx", "pdf"] # excel文件先注释 unless suffix_arr.include?(suffix) if params[:client_key].present?