试卷的提交修改

dev_hjm_a
SylorHuang 5 years ago
parent 2aa630e911
commit 0629bc15af

@ -1077,7 +1077,17 @@ class ExercisesController < ApplicationController
def commit_exercise
ActiveRecord::Base.transaction do
begin
if @user_course_identity > Course::ASSISTANT_PROFESSOR #为学生时
can_commit_exercise = false
if (@user_course_identity > Course::ASSISTANT_PROFESSOR) && params[:commit_method].present? #为学生时
if params[:commit_method].to_i == 2 #自动提交时
user_left_time = get_exercise_left_time(@exercise,current_user)
if user_left_time.to_i <= 0
can_commit_exercise = true
end
else
can_commit_exercise = true
end
if can_commit_exercise
objective_score = calculate_student_score(@exercise,current_user)[:total_score]
subjective_score = @answer_committed_user.subjective_score
total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score
@ -1094,6 +1104,11 @@ class ExercisesController < ApplicationController
@answer_committed_user.update_attributes(commit_option)
CommitExercsieNotifyJobJob.perform_later(@exercise.id, current_user.id)
normal_status(0,"试卷提交成功!")
else
normal_status(-1,"提交失败,请重试!")
end
else
normal_status(-1,"提交失败,请重试!")
end
rescue Exception => e
uid_logger_error(e.message)

Loading…
Cancel
Save