diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index 4024a2629..3f020a424 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -164,7 +164,11 @@ class ChallengesController < ApplicationController @challenges = @shixun.challenges.joins(join_sql).select(base_columns).uniq - @shixun_modify = (@challenges.select{|c| c.status.present? }.size == @challenges.size) + @shixun_modify = (@challenges.select{|c| !c.status.nil? }.size != @challenges.size) + + logger.info("########shixun_modify:#{@shixun_modify}") + logger.info("########challenges.size:#{@challenges.size}") + logger.info("########challenge_inspect:#{@challenges.inspect}") #@challenges = @shixun.challenges.fields_for_list @editable = @shixun.status == 0 # before_action:有判断权限,如果没发布,则肯定是管理人员 diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index c6e7a1eda..d99c59c85 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -992,7 +992,7 @@ class ExercisesController < ApplicationController else @ex_end_time = @exercise.get_exercise_end_time(current_user.id) - commit_exercise_user @exercise, exercise_user if @ex_end_time < Time.now + commit_exercise_user @exercise, exercise_user if @ex_end_time.present? && @ex_end_time < Time.now end # @ex_end_time = @exercise.get_exercise_end_time(current_user.id) # if ex_answer_time > 0 @@ -1192,7 +1192,7 @@ class ExercisesController < ApplicationController if @exercise.time > 0 start_time = Time.current - @exercise.time * 60 - ex_user_ids = @exercise_users_list.where("start_at <= '#{Time.at(start_time)}' and commit_status = 0").pluck(:user_id) + ex_user_ids = @exercise_users_list.where("start_at <= '#{Time.at(start_time)}' and commit_status = 0").pluck(:id) if ex_user_ids.size > 0 EndExerciseCalculateJob.perform_later(ex_user_ids, @exercise, Time.now.to_s, false, 2) end diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index fab9e98cd..19c4e14f3 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -968,18 +968,19 @@ module ExercisesHelper subjective_score = exercise_user.subjective_score < 0.0 ? 0.0 : exercise_user.subjective_score total_score = objective_score + subjective_score - if commit_time.nil? - if exercise.time > 0 - start_time = Time.at(exercise_user.start_at + exercise.time * 60) - end_time = start_time > exercise_end_time ? exercise_end_time : start_time - commit_method = start_time > exercise_end_time ? 3 : 2 - else - commit_method = 3 - end_time = exercise_end_time - end + if exercise.time > 0 + start_time = Time.at(exercise_user.start_at + exercise.time * 60) + end_time = start_time > exercise_end_time ? exercise_end_time : start_time + commit_method = start_time > exercise_end_time ? 3 : 2 else + commit_method = 3 + end_time = exercise_end_time + end + + unless commit_time.nil? commit_method = 1 end + commit_time = commit_time.present? && end_time > commit_time ? commit_time : end_time commit_option = {