From 1466f0133ccf695100a32f235ad1f7007e880442 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 15 May 2019 10:26:29 +0800 Subject: [PATCH] 1 --- app/controllers/myshixuns_controller.rb | 2 +- app/services/games_service.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index 3115befa..e34e4563 100755 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -545,7 +545,7 @@ class MyshixunsController < ApplicationController challenge.path.split(";").each do |path| game_passed_code(game.id, path, myshixun.try(:gpid), 1) end - if game.answer_open && (challenge.shixun.try(:status) > 1) # 如果没有查看答案,则获得该关卡得分 + if !game.answer_open && (challenge.shixun.try(:status) > 1) # 如果没有查看答案,则获得该关卡得分 reward_grade(game.user, game.id, 'Game', challenge.score) reward_experience(game.user, game.id, 'Game', challenge.score) game.update_attributes!(:final_score => challenge.score) diff --git a/app/services/games_service.rb b/app/services/games_service.rb index 5bbf09fd..f338a4a5 100755 --- a/app/services/games_service.rb +++ b/app/services/games_service.rb @@ -277,7 +277,7 @@ class GamesService challenge_score = challenge.try(:score) final_score = @game.final_score if current_user.grade.to_i - challenge_score > 0 - if @game.answer_open # 如果这是第一次查看答案 + if !@game.answer_open # 如果这是第一次查看答案 if challenge.st == 0 final_score = final_score - challenge_score # 积分消耗情况记录 @@ -718,7 +718,7 @@ class GamesService if had_passed && !game.had_passed? game.update_attributes(:status => 2, :end_time => Time.now) # TPM实训已发布并且没有查看答案 - if shixun.is_published? && game.answer_open.to_i == 0 + if shixun.is_published? && !game.answer_open # 查看答案的时候处理final_scor和扣分记录 experience = score reward_grade(myshixun.owner, game.id, 'Game', score)