dev_local
daiao 6 years ago
parent 11ea376bc6
commit 1466f0133c

@ -545,7 +545,7 @@ class MyshixunsController < ApplicationController
challenge.path.split("").each do |path| challenge.path.split("").each do |path|
game_passed_code(game.id, path, myshixun.try(:gpid), 1) game_passed_code(game.id, path, myshixun.try(:gpid), 1)
end 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_grade(game.user, game.id, 'Game', challenge.score)
reward_experience(game.user, game.id, 'Game', challenge.score) reward_experience(game.user, game.id, 'Game', challenge.score)
game.update_attributes!(:final_score => challenge.score) game.update_attributes!(:final_score => challenge.score)

@ -277,7 +277,7 @@ class GamesService
challenge_score = challenge.try(:score) challenge_score = challenge.try(:score)
final_score = @game.final_score final_score = @game.final_score
if current_user.grade.to_i - challenge_score > 0 if current_user.grade.to_i - challenge_score > 0
if @game.answer_open # 如果这是第一次查看答案 if !@game.answer_open # 如果这是第一次查看答案
if challenge.st == 0 if challenge.st == 0
final_score = final_score - challenge_score final_score = final_score - challenge_score
# 积分消耗情况记录 # 积分消耗情况记录
@ -718,7 +718,7 @@ class GamesService
if had_passed && !game.had_passed? if had_passed && !game.had_passed?
game.update_attributes(:status => 2, :end_time => Time.now) game.update_attributes(:status => 2, :end_time => Time.now)
# TPM实训已发布并且没有查看答案 # TPM实训已发布并且没有查看答案
if shixun.is_published? && game.answer_open.to_i == 0 if shixun.is_published? && !game.answer_open
# 查看答案的时候处理final_scor和扣分记录 # 查看答案的时候处理final_scor和扣分记录
experience = score experience = score
reward_grade(myshixun.owner, game.id, 'Game', score) reward_grade(myshixun.owner, game.id, 'Game', score)

Loading…
Cancel
Save