Merge remote-tracking branch 'origin/dev_aliyun' into dev_tj

merge from aliyun
dev_forge
tangjiang 5 years ago
commit 0a2c30b4cb

@ -768,7 +768,7 @@ class GamesController < ApplicationController
# REDO:需要添加详细的说明
def cost_time
#return if @game.status >= 2
cost_time = (params[:time].to_i < 0 ? 0 : params[:time].to_i) + @game.cost_time.to_i
cost_time = params[:time].to_i < @game.cost_time.to_i ? (@game.cost_time.to_i + params[:time].to_i) : params[:time].to_i
@game.update_attribute(:cost_time, cost_time)
end

@ -699,6 +699,10 @@ class User < ApplicationRecord
LimitForbidControl::UserLogin.new(self).clear
end
def from_sub_site?
laboratory_id.present? && laboratory_id != 1
end
protected
def validate_password_length
# 管理员的初始密码是5位

@ -0,0 +1 @@
json.identifier @game.identifier

@ -130,7 +130,6 @@ class TPIContextProvider extends Component {
tpm_modified,
tpm_script_modified,
showUpdateDialog: false,
initTime: 0
})
}
@ -167,7 +166,7 @@ class TPIContextProvider extends Component {
}
// force 评测通过后异步执行该方法强制同步costTime到服务端
_updateCostTime(async = false, force) {
const { game, loading, initTime = 0 } = this.state;
const { game, loading } = this.state;
// TODO 还有一种情况通关后cost_time计时停止没法通过这个判断
if (!force && (loading || !game || game.status === 2)) {
return; // 已完成的任务不需要处理
@ -178,13 +177,12 @@ class TPIContextProvider extends Component {
}
// var url = `${testPath}/api/v1/games/${ game.identifier }/cost_time`
var url = `${testPath}/api/tasks/${ game.identifier }/cost_time`
const disTime = Math.abs(game.cost_time - initTime);
window.$.ajax({
type: 'get',
url: url,
async: async, //IMPORTANT, the call will be synchronous
data: {
time: disTime
time: game.cost_time
}
}).done((data) => {
console.log('complete');
@ -440,7 +438,6 @@ pop_box_new(htmlvalue, 480, 182);
this.setState({
...resData,
initTime: game.cost_time,
currentGamePassed: false,
loading: false,
testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0),

Loading…
Cancel
Save