From 06ab8e9ce9eec06e0f1d940aed7161b8a30ebdeb Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Fri, 14 Jan 2022 14:40:33 +0800 Subject: [PATCH] benchmark types --- models/cloudbrain.go | 13 ++++++++++--- routers/repo/cloudbrain.go | 4 +++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/models/cloudbrain.go b/models/cloudbrain.go index 2f41a478f..087b082cd 100755 --- a/models/cloudbrain.go +++ b/models/cloudbrain.go @@ -99,7 +99,7 @@ type Cloudbrain struct { CanDel bool `xorm:"-"` CanModify bool `xorm:"-"` Type int - BenchmarkType string `xorm:"DEFAULT ''"` + BenchmarkType string `xorm:"DEFAULT ''"` VersionID int64 //版本id VersionName string `xorm:"INDEX"` //当前版本 @@ -386,8 +386,15 @@ type BenchmarkTypes struct { } type BenchmarkType struct { - Id int `json:"id"` - Value string `json:"value"` + Id int `json:"id"` + First string `json:"first"` //一级算法类型名称 + Second []*BenchmarkDataset `json:"second"` +} + +type BenchmarkDataset struct { + Id int `json:"id"` + Value string `json:"value"` //二级算法类型名称 + Attachment string `json:"attachment"` //数据集的uuid } type GpuInfos struct { diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index bb167e833..587c275ad 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -127,7 +127,9 @@ func cloudBrainNewDataPrepare(ctx *context.Context) error { ctx.Data["benchmark_categories"] = categories.Category if benchmarkTypes == nil { - json.Unmarshal([]byte(setting.BenchmarkTypes), &benchmarkTypes) + if err := json.Unmarshal([]byte(setting.BenchmarkTypes), &benchmarkTypes); err != nil { + log.Error("json.Unmarshal BenchmarkTypes(%s) failed:%v", setting.BenchmarkTypes, err, ctx.Data["MsgID"]) + } } ctx.Data["benchmark_types"] = benchmarkTypes.BenchmarkType