Reviewed-on: https://openi.pcl.ac.cn/OpenI/aiforge/pulls/3499 Reviewed-by: ychao_1983 <ychao_1983@sina.com>fix-3470
@@ -1030,18 +1030,14 @@ func getCloudBrainInfo(dateRecordAll UserBusinessAnalysisAll, CloudBrainTaskItem | |||||
} | } | ||||
cloudBrainInfo["inference_task_num"] = fmt.Sprint(dateRecordAll.NpuInferenceJob + CloudBrainTaskItemMap[fmt.Sprint(dateRecordAll.ID)+"_GpuInferenceJob"]) | cloudBrainInfo["inference_task_num"] = fmt.Sprint(dateRecordAll.NpuInferenceJob + CloudBrainTaskItemMap[fmt.Sprint(dateRecordAll.ID)+"_GpuInferenceJob"]) | ||||
cloudBrainInfo["card_runtime"] = fmt.Sprint(dateRecordAll.CloudBrainRunTime) | cloudBrainInfo["card_runtime"] = fmt.Sprint(dateRecordAll.CloudBrainRunTime) | ||||
if dateRecordAll.CloudBrainRunTime >= 100 { | |||||
runtime = float64(dateRecordAll.CloudBrainRunTime) / float64(100) | |||||
} | |||||
cloudBrainInfo["card_runtime_money"] = fmt.Sprint(dateRecordAll.CloudBrainRunTime * 5) | cloudBrainInfo["card_runtime_money"] = fmt.Sprint(dateRecordAll.CloudBrainRunTime * 5) | ||||
cloudBrainInfo["CloudBrainOne"] = fmt.Sprint(CloudBrainTaskItemMap[fmt.Sprint(dateRecordAll.ID)+"_CloudBrainOne"]) | cloudBrainInfo["CloudBrainOne"] = fmt.Sprint(CloudBrainTaskItemMap[fmt.Sprint(dateRecordAll.ID)+"_CloudBrainOne"]) | ||||
cloudBrainInfo["CloudBrainTwo"] = fmt.Sprint(CloudBrainTaskItemMap[fmt.Sprint(dateRecordAll.ID)+"_CloudBrainTwo"]) | cloudBrainInfo["CloudBrainTwo"] = fmt.Sprint(CloudBrainTaskItemMap[fmt.Sprint(dateRecordAll.ID)+"_CloudBrainTwo"]) | ||||
cloudBrainInfo["C2Net"] = fmt.Sprint(CloudBrainTaskItemMap[fmt.Sprint(dateRecordAll.ID)+"_C2Net"]) | cloudBrainInfo["C2Net"] = fmt.Sprint(CloudBrainTaskItemMap[fmt.Sprint(dateRecordAll.ID)+"_C2Net"]) | ||||
cloudBrainInfoJson, _ := json.Marshal(cloudBrainInfo) | cloudBrainInfoJson, _ := json.Marshal(cloudBrainInfo) | ||||
scoreMap["trainscore"] = trainscore | scoreMap["trainscore"] = trainscore | ||||
scoreMap["debugscore"] = debugscore | scoreMap["debugscore"] = debugscore | ||||
scoreMap["runtime"] = runtime | |||||
return string(cloudBrainInfoJson) | return string(cloudBrainInfoJson) | ||||
} else { | } else { | ||||
scoreMap["trainscore"] = trainscore | scoreMap["trainscore"] = trainscore | ||||
@@ -81,7 +81,12 @@ func Toggle(options *ToggleOptions) macaron.Handler { | |||||
// Redirect to dashboard if user tries to visit any non-login page. | // Redirect to dashboard if user tries to visit any non-login page. | ||||
if options.SignOutRequired && ctx.IsSigned && ctx.Req.URL.RequestURI() != "/" { | if options.SignOutRequired && ctx.IsSigned && ctx.Req.URL.RequestURI() != "/" { | ||||
ctx.Redirect(setting.AppSubURL + "/") | |||||
redirectTo := ctx.Query("redirect_to") | |||||
if len(redirectTo) > 0 { | |||||
ctx.Redirect(redirectTo) | |||||
} else { | |||||
ctx.Redirect(setting.AppSubURL + "/") | |||||
} | |||||
return | return | ||||
} | } | ||||
@@ -121,7 +121,6 @@ func checkAutoLogin(ctx *context.Context) bool { | |||||
ctx.ServerError("AutoSignIn", err) | ctx.ServerError("AutoSignIn", err) | ||||
return true | return true | ||||
} | } | ||||
redirectTo := ctx.Query("redirect_to") | redirectTo := ctx.Query("redirect_to") | ||||
if len(redirectTo) > 0 { | if len(redirectTo) > 0 { | ||||
ctx.SetCookie("redirect_to", redirectTo, 0, setting.AppSubURL, "", setting.SessionConfig.Secure, true) | ctx.SetCookie("redirect_to", redirectTo, 0, setting.AppSubURL, "", setting.SessionConfig.Secure, true) | ||||
@@ -130,7 +129,6 @@ func checkAutoLogin(ctx *context.Context) bool { | |||||
} | } | ||||
if isSucceed { | if isSucceed { | ||||
isCourse := ctx.QueryBool("course") | isCourse := ctx.QueryBool("course") | ||||
ctx.SetCookie("redirect_to", "", -1, setting.AppSubURL, "", setting.SessionConfig.Secure, true) | ctx.SetCookie("redirect_to", "", -1, setting.AppSubURL, "", setting.SessionConfig.Secure, true) | ||||
if redirectTo == "" && isCourse { | if redirectTo == "" && isCourse { | ||||
@@ -138,7 +136,6 @@ func checkAutoLogin(ctx *context.Context) bool { | |||||
ctx.RedirectToFirst(redirectToCourse) | ctx.RedirectToFirst(redirectToCourse) | ||||
} else { | } else { | ||||
ctx.RedirectToFirst(redirectTo, setting.AppSubURL+string(setting.LandingPageURL)) | ctx.RedirectToFirst(redirectTo, setting.AppSubURL+string(setting.LandingPageURL)) | ||||
} | } | ||||
return true | return true | ||||
} | } | ||||
@@ -154,7 +151,6 @@ func getActivityTpl() string { | |||||
// SignIn render sign in page | // SignIn render sign in page | ||||
func SignIn(ctx *context.Context) { | func SignIn(ctx *context.Context) { | ||||
ctx.Data["Title"] = ctx.Tr("sign_in") | ctx.Data["Title"] = ctx.Tr("sign_in") | ||||
// Check auto-login. | // Check auto-login. | ||||
if checkAutoLogin(ctx) { | if checkAutoLogin(ctx) { | ||||
return | return | ||||