From fb0dc42e2bfa53efc66db28925b21585c5f7777e Mon Sep 17 00:00:00 2001 From: liuzx Date: Tue, 7 Jun 2022 18:36:04 +0800 Subject: [PATCH] update --- routers/api/v1/repo/cloudbrain_dashboard.go | 27 ++++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/routers/api/v1/repo/cloudbrain_dashboard.go b/routers/api/v1/repo/cloudbrain_dashboard.go index 46ecefe59..d6f03923c 100644 --- a/routers/api/v1/repo/cloudbrain_dashboard.go +++ b/routers/api/v1/repo/cloudbrain_dashboard.go @@ -159,6 +159,18 @@ func GetAllCloudbrainsTrend(ctx *context.Context) { ctx.Error(http.StatusBadRequest, ctx.Tr("getYearCloudbrainNum_get_error")) return } + } else if queryType == "today" { + beginTime = now.AddDate(0, 0, 0) + beginTime = time.Date(beginTime.Year(), beginTime.Month(), beginTime.Day(), 0, 0, 0, 0, now.Location()) + endTimeTemp = beginTime.Add(time.Hour) + endTime = now + dateCloudbrainNum, err = getHourCloudbrainNum(beginTime, endTimeTemp, endTime) + if err != nil { + log.Error("Can not query getHourCloudbrainNum.", err) + ctx.Error(http.StatusBadRequest, ctx.Tr("getYearCloudbrainNum_get_error")) + return + } + } else if queryType == "yesterday" { beginTime = now.AddDate(0, 0, -1) beginTime = time.Date(beginTime.Year(), beginTime.Month(), beginTime.Day(), 0, 0, 0, 0, now.Location()) @@ -489,10 +501,17 @@ func GetCloudbrainsDetailData(ctx *context.Context) { pageSize = 10 } + // var jobTypes []string + // jobTypeNot := false + // if jobType == string(models.JobTypeDebug) { + // jobTypes = append(jobTypes, string(models.JobTypeSnn4imagenet), string(models.JobTypeBrainScore), string(models.JobTypeDebug)) + // } else if jobType != "all" && jobType != "" { + // jobTypes = append(jobTypes, jobType) + // } var jobTypes []string jobTypeNot := false - if jobType == string(models.JobTypeDebug) { - jobTypes = append(jobTypes, string(models.JobTypeSnn4imagenet), string(models.JobTypeBrainScore), string(models.JobTypeDebug)) + if jobType == string(models.JobTypeBenchmark) { + jobTypes = append(jobTypes, string(models.JobTypeBenchmark), string(models.JobTypeBrainScore), string(models.JobTypeSnn4imagenet)) } else if jobType != "all" && jobType != "" { jobTypes = append(jobTypes, jobType) } @@ -594,8 +613,8 @@ func GetCloudbrainsCreateHoursData(ctx *context.Context) { beginTime = recordBeginTime endTime = now } else if queryType == "today" { - beginTime = now.AddDate(0, 0, 0) - endTime = time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location()) + beginTime = time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location()) + endTime = now.AddDate(0, 0, 1) } else if queryType == "yesterday" { beginTime = now.AddDate(0, 0, -1) endTime = time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location())