作品重置时删除相关的评阅记录

courseware
cxt 5 years ago
parent f56574a926
commit bb68c3cff8

@ -27,9 +27,15 @@ class MyshixunsController < ApplicationController
ActiveRecord::Base.transaction do
@myshixun.destroy!
StudentWork.where(:myshixun_id => @myshixun.id).includes(:shixun_work_comments, :student_works_scores, :challenge_work_scores).each do |work|
work.shixun_work_comments.destroy_all
work.student_works_scores.destroy_all
work.challenge_work_scores.destroy_all
end
StudentWork.where(:myshixun_id => @myshixun.id)
.update_all(myshixun_id: 0, work_status: 0, work_score: nil,
final_score: nil, efficiency: 0, eff_score: 0, calculation_time: nil, cost_time: 0, compelete_status: -1)
final_score: nil, efficiency: 0, eff_score: 0, calculation_time: nil, ultimate_score: 0, cost_time: 0, compelete_status: -1)
end
# 删除版本库
GitService.delete_repository(repo_path: @repo_path) unless @shixun.is_choice_type?

Loading…
Cancel
Save