|
|
|
@ -610,7 +610,7 @@ class ExercisesController < ApplicationController
|
|
|
|
|
# 对未提交的用户进行调分
|
|
|
|
|
def adjust_score
|
|
|
|
|
exercise_user = @exercise.exercise_users.find_by!(user_id: params[:user_id])
|
|
|
|
|
tip_exception("已提交的作品请去评阅页进行调分") if exercise_user.commit_status == 1
|
|
|
|
|
tip_exception("已提交的作品请去评阅页进行调分") if exercise_user.commit_status == 1 && exercise_user.commit_method != 5
|
|
|
|
|
if @exercise.subjective_score > 0
|
|
|
|
|
tip_exception("主观题成绩不能为空") if params[:subjective_score].blank?
|
|
|
|
|
tip_exception("主观题成绩不能小于零") if params[:subjective_score].to_f < 0
|
|
|
|
@ -628,8 +628,13 @@ class ExercisesController < ApplicationController
|
|
|
|
|
subjective_score = @exercise.subjective_score > 0 ? params[:subjective_score].to_f.round(2) : 0
|
|
|
|
|
objective_score = @exercise.objective_score > 0 ? params[:objective_score].to_f.round(2) : 0
|
|
|
|
|
score = subjective_score + objective_score
|
|
|
|
|
exercise_user.update_attributes!(start_at: start_at_time, end_at: Time.now, status: 1, commit_status: 1, score: score,
|
|
|
|
|
subjective_score: subjective_score, objective_score: objective_score, commit_method: 5)
|
|
|
|
|
if exercise_user.commit_status == 1
|
|
|
|
|
exercise_user.update_attributes!(score: score, subjective_score: subjective_score, objective_score: objective_score)
|
|
|
|
|
else
|
|
|
|
|
exercise_user.update_attributes!(start_at: start_at_time, end_at: Time.now, status: 1, commit_status: 1, score: score,
|
|
|
|
|
subjective_score: subjective_score, objective_score: objective_score, commit_method: 5)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
ExerciseUserScore.create!(exercise_id: @exercise.id, exercise_user_id: exercise_user.id,
|
|
|
|
|
subjective_score: subjective_score, objective_score: objective_score)
|
|
|
|
|
normal_status("操作成功")
|
|
|
|
|