diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index 91cff3c19..035b43955 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -182,7 +182,13 @@ class MyshixunsController < ApplicationController test_set_percentage = test_set_score / 100.to_f # 测试集得分比 score = (challenge.score * test_set_percentage * answer_deduction_percentage).to_i # 如果分数比上次多,则更新成绩 - game.update_attributes!(:status => 0, :final_score => score) if game.final_score < score + game_update = + if game.final_score < score + {final_score: score, status: 0} + else + {status: 0} + end + game.update_attributes!(game_update) end end test_cases_time = format("%.3f", (Time.now.to_f - t1.to_f)).to_f