|
|
@ -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)
|
|
|
|