diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e0639de3f..fdb41c114 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -23,7 +23,7 @@ class ApplicationController < ActionController::Base # 所有请求必须合法签名 def check_sign - if !Rails.env.development? && EduSetting.get("host_name") != "https://test-newweb.educoder.net" + if !Rails.env.development? Rails.logger.info("66666 #{params}") # suffix = request.url.split(".").last.split("?").first # suffix_arr = ["xls", "xlsx", "pdf", "zip"] # excel文件先注释 diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index 5b555cf4c..44bfcf03f 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -402,7 +402,7 @@ class ExercisesController < ApplicationController if unified_setting || (course_group_ids.size == 0) tip_exception("发布时间不能为空") if params[:publish_time].blank? tip_exception("截止时间不能为空") if params[:end_time].blank? - tip_exception("截止时间不能早于发布时间") if params[:publish_time].to_time > params[:end_time].to_time + tip_exception("截止时间必须晚于发布时间") if params[:publish_time].to_time >= params[:end_time].to_time tip_exception("截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if @course.end_date.present? && params[:end_time].to_time > @course.end_date.end_of_day params_publish_time = params[:publish_time].to_time diff --git a/app/controllers/graduation_tasks_controller.rb b/app/controllers/graduation_tasks_controller.rb index cac763344..6196aa5f5 100644 --- a/app/controllers/graduation_tasks_controller.rb +++ b/app/controllers/graduation_tasks_controller.rb @@ -384,11 +384,11 @@ class GraduationTasksController < ApplicationController if @task.status == 0 tip_exception("发布时间不能为空") if params[:publish_time].blank? tip_exception("截止时间不能为空") if params[:end_time].blank? - 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 params[:publish_time].to_time <= Time.now + tip_exception("截止时间不能早于当前时间") if params[:end_time].to_time <= Time.now + tip_exception("截止时间必须晚于发布时间") if params[:publish_time].to_time >= params[:end_time].to_time tip_exception("截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if - @course.end_date.present? && params[:end_time] > strf_time(@course.end_date.end_of_day) + @course.end_date.present? && params[:end_time].to_time > @course.end_date.end_of_day @task.publish_time = params[:publish_time] @task.end_time = params[:end_time] diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index c9c9cc567..d320379be 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -724,7 +724,7 @@ class PollsController < ApplicationController if unified_setting || (course_group_ids.size == 0) tip_exception("发布时间不能为空") if params[:publish_time].blank? tip_exception("截止时间不能为空") if params[:end_time].blank? - tip_exception("截止时间不能早于发布时间") if params[:publish_time].to_time > params[:end_time].to_time + tip_exception("截止时间必须晚于发布时间") if params[:publish_time].to_time >= params[:end_time].to_time tip_exception("截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if @course.end_date.present? && params[:end_time].to_time > @course.end_date.end_of_day diff --git a/app/services/update_homework_publish_setting_service.rb b/app/services/update_homework_publish_setting_service.rb index 69a68b613..61902cd80 100644 --- a/app/services/update_homework_publish_setting_service.rb +++ b/app/services/update_homework_publish_setting_service.rb @@ -15,11 +15,11 @@ class UpdateHomeworkPublishSettingService < ApplicationService if params[:unified_setting] || course.course_groups_count == 0 tip_exception("发布时间不能为空") if params[:publish_time].blank? tip_exception("截止时间不能为空") if params[:end_time].blank? - 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 params[:publish_time].to_time <= Time.now + tip_exception("截止时间不能早于当前时间") if params[:end_time].to_time <= Time.now + tip_exception("截止时间必须晚于发布时间") if params[:publish_time].to_time >= params[:end_time].to_time tip_exception("截止时间不能晚于课堂结束时间(#{course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if - course.end_date.present? && params[:end_time] > course.end_date.end_of_day + course.end_date.present? && params[:end_time].to_time > course.end_date.end_of_day homework.unified_setting = 1 homework.homework_group_settings.destroy_all diff --git a/db/migrate/20200114071420_migrate_course_group_member_count.rb b/db/migrate/20200114071420_migrate_course_group_member_count.rb deleted file mode 100644 index 5273290f2..000000000 --- a/db/migrate/20200114071420_migrate_course_group_member_count.rb +++ /dev/null @@ -1,8 +0,0 @@ -class MigrateCourseGroupMemberCount < ActiveRecord::Migration[5.2] - def change - CourseGroup.reset_column_information - CourseGroup.find_each do |group| - CourseGroup.reset_counters(group.id, :course_members_count) - end - end -end