tpi耗时情况

dev_home
daiao 5 years ago
parent 97b542ea00
commit aba87a146a

@ -767,8 +767,9 @@ class GamesController < ApplicationController
# 记录实训花费的时间
# REDO:需要添加详细的说明
def cost_time
cost_time = params[:time].to_i
@game.update_attribute(:cost_time, cost_time)
return if @game.status >= 2
cost_time = Time.now.to_i - @game.close_browse_time.to_i
@game.update_attributes(close_browse_time: Time.now, cost_time: cost_time)
end
# 同步challenge的更新时间
@ -938,6 +939,7 @@ class GamesController < ApplicationController
game.update_attributes(status: 0, open_time: Time.now) if game.open_time.blank? || game.status == 3
# 开启实训更新myshixuns的时间方便跟踪用于的学习进度。
game.myshixun.update_column(:updated_at, Time.now)
@game.update_attribute(:close_browse_time, Time.now) if game.status < 2 && @game.close_browse_time.nil?
end
# vnc连接

@ -0,0 +1,5 @@
class AddCloseBrowserTimeForGames < ActiveRecord::Migration[5.2]
def change
add_column :games, :close_browse_time, :timestamp
end
end
Loading…
Cancel
Save