试卷的调整

dev_local
cxt 6 years ago
parent beb84c9bfa
commit 17a675702a

@ -841,7 +841,7 @@ class ExerciseController < ApplicationController
exercise_users.each do |exercise_user|
if exercise_user.commit_status == 0 && !exercise_user.start_at.nil?
time = (exercise_user.start_at.to_i + @exercise.time.to_i * 60) > @exercise.end_time.to_i ? @exercise.end_time : Time.at(exercise_user.start_at.to_i + @exercise.time.to_i * 60)
# time = (exercise_user.start_at.to_i + @exercise.time.to_i * 60) > @exercise.end_time.to_i ? @exercise.end_time : Time.at(exercise_user.start_at.to_i + @exercise.time.to_i * 60)
exercise_user.update_attributes(:status => 1, :commit_status => 1, :end_at => time)
s_score = calculate_student_score(@exercise, exercise_user.user)
exercise_user.update_attributes(:objective_score => s_score, :score => (s_score + (exercise_user.subjective_score && exercise_user.subjective_score > 0 ? exercise_user.subjective_score : 0)))

@ -1,14 +0,0 @@
class UpdateExeriseUserEndAt < ActiveRecord::Migration
def up
exercise = Exercise.where(:id => 123).first
exercise.exercise_group_settings.each do |group|
if group.end_time.present? && group.end_time < Time.now
user_ids = exercise.course.members.where(:course_group_id => group.course_group_id).map(&:user_id)
exercise.exercise_users.where(:commit_status => 1, :user_id => user_ids).update_all(:end_at => group.end_time)
end
end
end
def down
end
end
Loading…
Cancel
Save