diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 64d03cbac..254d04cfd 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -24,8 +24,8 @@ class ApplicationController < ActionController::Base # 所有请求必须合法签名 def check_sign Rails.logger.info("66666 #{params}") - suffix = request.url.split(".").last - suffix_arr = ["xls", "xlsx"] # excel文件先注释 + suffix = request.url.split(".").last.split("?").first + suffix_arr = ["xls", "xlsx", "pdf"] # excel文件先注释 unless suffix_arr.include?(suffix) if params[:client_key].present? randomcode = params[:randomcode] 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 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 diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index 08d0da42f..3e6914dee 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 => poll_end_time } end the_group_setting.update_attributes(poll_group_params) 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 44a09adae..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,6 +197,7 @@ class PollDetailTabForth extends Component{ this.props.form.validateFieldsAndScroll((err, values) => { if(!err){ + // 第一次进行问卷设置或者勾选了统一设置 let{unitSetting}=this.state if(unitSetting==true){