From 96b9da47b273e65876e0c204dea63f24d0b6d8dc Mon Sep 17 00:00:00 2001 From: Taekyu Date: Mon, 19 Jun 2023 11:13:04 +0900 Subject: [PATCH] trivial. change to empty value after today on pod-restart-calendar. --- internal/usecase/dashboard.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/internal/usecase/dashboard.go b/internal/usecase/dashboard.go index 60c15f94..b6f9693d 100644 --- a/internal/usecase/dashboard.go +++ b/internal/usecase/dashboard.go @@ -391,23 +391,23 @@ func (u *DashboardUsecase) getChartFromPrometheus(organizationId string, chartTy } baseDate := d.Format("2006-01-02") - if baseDate > now.Format("2006-01-02") { - break - } - + cntPodRestartStr := "" cntPodRestart := 0 - for _, alert := range alerts { - strDate := alert.CreatedAt.Format("2006-01-02") - if strDate == baseDate { - cntPodRestart += 1 + if baseDate <= now.Format("2006-01-02") { + for _, alert := range alerts { + strDate := alert.CreatedAt.Format("2006-01-02") + + if strDate == baseDate { + cntPodRestart += 1 + } } + cntPodRestartStr = fmt.Sprintf("%d", int(cntPodRestart)) } dd := time.Date(d.Year(), d.Month(), d.Day(), 0, 0, 0, 0, time.UTC) xAxisData = append(xAxisData, strconv.Itoa(int(dd.Unix()))) - yAxisData = append(yAxisData, fmt.Sprintf("%d", int(cntPodRestart))) - + yAxisData = append(yAxisData, cntPodRestartStr) } chartData.XAxis.Data = xAxisData