Browse Source

update

tags/v1.22.6.1^2
liuzx 3 years ago
parent
commit
fb0dc42e2b
1 changed files with 23 additions and 4 deletions
  1. +23
    -4
      routers/api/v1/repo/cloudbrain_dashboard.go

+ 23
- 4
routers/api/v1/repo/cloudbrain_dashboard.go View File

@@ -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())


Loading…
Cancel
Save