From a58bd2552a405d20c1e08e4bca06f1af2107a7b7 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 27 Jun 2019 11:26:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=A3=E5=88=86=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/games_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index 5fe230d32..32175ec2f 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -270,7 +270,8 @@ class GamesController < ApplicationController if @game.status == 2 @game.update_attributes!(:answer_open => @answer.level) else - @game.update_attributes!(:answer_open => @answer.level, :answer_deduction => deduct_score) + answer_deduction = challenge.challenge_answers.where("level <= #{@answer.level}").sum(:score) + @game.update_attributes!(:answer_open => @answer.level, :answer_deduction => answer_deduction) end rescue Exception => e