diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index ccadba89c..e3b72e62d 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -448,7 +448,7 @@ class HomeworkCommonsController < ApplicationController tip_exception("发布时间不能早于当前时间") if params[:publish_time] <= Time.now.strftime("%Y-%m-%d %H:%M:%S") tip_exception("截止时间不能早于当前时间") if params[:end_time] <= Time.now.strftime("%Y-%m-%d %H:%M:%S") tip_exception("截止时间不能早于发布时间") if params[:publish_time] > params[:end_time] - tip_exception("截止时间不能早于课堂结束时间") if @course.end_date.present? && params[:end_time] > @course.end_date.end_of_day + tip_exception("截止时间不能晚于课堂结束时间") if @course.end_date.present? && params[:end_time] > @course.end_date.end_of_day @homework.unified_setting = 1 @homework.homework_group_settings.destroy_all @@ -1086,6 +1086,7 @@ class HomeworkCommonsController < ApplicationController homework.publish_time = Time.now # 截止时间不为空的保持原状,为空的改为一个月后, 非统一设置的更新为最大分班截止时间 + if homework.end_time.nil? homework.end_time = params[:end_time] elsif homework.max_group_end_time diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index 469c0bd4d..6262d9ef9 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -288,13 +288,6 @@ class PollsController < ApplicationController poll_unified = true e_time = ex_end_time end - # if poll.end_time.blank? - # e_time = ex_end_time - # elsif poll.poll_group_settings.end_time_present.count > 0 # 该问卷分组有结束时间为空的 - # e_time = poll.poll_group_settings.end_time_present.map(&:end_time).max - # else - # e_time = poll.end_time - # end poll_status = set_poll_status(Time.now,e_time) poll_params = { diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index 32e5d1bfc..fc1e7874e 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -116,7 +116,6 @@ module ExercisesHelper right_users_count = 0 #该问题的回答正确的人数 user_ids.each do |user_id| ex_choice_ids = effictive_users.map{|e| e.exercise_choice_id if e.user_id == user_id}.reject(&:blank?).uniq - # answer_choice_array = ex_choices.where(id:ex_choice_ids).pluck(:choice_position) answer_choice_array = ex_choices.map{|a| a.choice_position if ex_choice_ids.include?(a.id)}.reject(&:blank?).uniq if answer_choice_array.sort == standard_answer right_users_count += 1