From bb68c3cff82506ceaccc07276bc2d9c97ca41a4b Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 18 Mar 2020 22:41:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=9C=E5=93=81=E9=87=8D=E7=BD=AE=E6=97=B6?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=9B=B8=E5=85=B3=E7=9A=84=E8=AF=84=E9=98=85?= =?UTF-8?q?=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/myshixuns_controller.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index 8713bebf3..655912d97 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -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?