Merge remote-tracking branch 'origin/dev_aliyun' into dev_aliyun

schedule_job
杨树明 5 years ago
commit 657fcbfe73

@ -164,7 +164,11 @@ class ChallengesController < ApplicationController
@challenges = @shixun.challenges.joins(join_sql).select(base_columns).uniq @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 #@challenges = @shixun.challenges.fields_for_list
@editable = @shixun.status == 0 # before_action有判断权限如果没发布则肯定是管理人员 @editable = @shixun.status == 0 # before_action有判断权限如果没发布则肯定是管理人员

@ -992,7 +992,7 @@ class ExercisesController < ApplicationController
else else
@ex_end_time = @exercise.get_exercise_end_time(current_user.id) @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 end
# @ex_end_time = @exercise.get_exercise_end_time(current_user.id) # @ex_end_time = @exercise.get_exercise_end_time(current_user.id)
# if ex_answer_time > 0 # if ex_answer_time > 0
@ -1192,7 +1192,7 @@ class ExercisesController < ApplicationController
if @exercise.time > 0 if @exercise.time > 0
start_time = Time.current - @exercise.time * 60 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 if ex_user_ids.size > 0
EndExerciseCalculateJob.perform_later(ex_user_ids, @exercise, Time.now.to_s, false, 2) EndExerciseCalculateJob.perform_later(ex_user_ids, @exercise, Time.now.to_s, false, 2)
end end

@ -968,7 +968,6 @@ module ExercisesHelper
subjective_score = exercise_user.subjective_score < 0.0 ? 0.0 : exercise_user.subjective_score subjective_score = exercise_user.subjective_score < 0.0 ? 0.0 : exercise_user.subjective_score
total_score = objective_score + subjective_score total_score = objective_score + subjective_score
if commit_time.nil?
if exercise.time > 0 if exercise.time > 0
start_time = Time.at(exercise_user.start_at + exercise.time * 60) start_time = Time.at(exercise_user.start_at + exercise.time * 60)
end_time = start_time > exercise_end_time ? exercise_end_time : start_time end_time = start_time > exercise_end_time ? exercise_end_time : start_time
@ -977,9 +976,11 @@ module ExercisesHelper
commit_method = 3 commit_method = 3
end_time = exercise_end_time end_time = exercise_end_time
end end
else
unless commit_time.nil?
commit_method = 1 commit_method = 1
end end
commit_time = commit_time.present? && end_time > commit_time ? commit_time : end_time commit_time = commit_time.present? && end_time > commit_time ? commit_time : end_time
commit_option = { commit_option = {

Loading…
Cancel
Save