diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index 1a6fe8ac7..23c72c5dc 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -769,7 +769,7 @@ class GamesController < ApplicationController def cost_time #return if @game.status >= 2 cost_time = (Time.now.to_i - @game.play_time.to_i) + @game.cost_time.to_i - @game.update_attributes(play_time: Time.now, cost_time: cost_time, play_sign: 0) + @game.update_attributes(cost_time: cost_time, play_sign: 0) end # 同步challenge的更新时间 diff --git a/app/models/game.rb b/app/models/game.rb index 7aa2e7264..d82392a59 100644 --- a/app/models/game.rb +++ b/app/models/game.rb @@ -3,7 +3,7 @@ # modify_time: 与challenges表的modify_time联合使用,2个字段一致,则标识测试集未修改,反之,被修改 # answer_open: 查看查看答案的深度, 0: 未查看过答案, 其他数值与challenge_answer的level值相关 # answer_deduction: 查看答案扣分的百分比;如 查看答案 扣除70% -# +#play_sign 与play_time: sign记录浏览器是否正常关闭, 0表示正常,1表示非正常; play_time:表示游玩时间 class Game < ApplicationRecord default_scope { order("games.created_at desc") }