diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index 5ce0418a6..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 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 = {