fix(index): bucket calculation

This commit is contained in:
Tine 2024-02-29 23:57:23 +01:00
parent 07c7c716c5
commit 820e597d72
Signed by: mentos1386
SSH key fingerprint: SHA256:MNtTsLbihYaWF8j1fkOHfkKNlnN1JQfxEU/rBU8nCGw
3 changed files with 8 additions and 8 deletions

View file

@ -31,7 +31,7 @@ type History struct {
}
func getHour(date time.Time) string {
return date.UTC().Format("2006-01-02T15:04")
return date.UTC().Format("2006-01-02T15:04:05")
}
func getHistory(history []*models.MonitorHistory, period time.Duration, buckets int) *History {
@ -45,7 +45,7 @@ func getHistory(history []*models.MonitorHistory, period time.Duration, buckets
}
for _, _history := range history {
hour := getHour(_history.CreatedAt.Time.Truncate(time.Hour))
hour := getHour(_history.CreatedAt.Time.Truncate(period))
// Skip if not part of the "buckets"
if _, ok := historyMap[hour]; !ok {

View file

@ -900,9 +900,9 @@ video {
background-color: rgb(243 244 246 / var(--tw-bg-opacity));
}
.bg-gray-400 {
.bg-gray-200 {
--tw-bg-opacity: 1;
background-color: rgb(156 163 175 / var(--tw-bg-opacity));
background-color: rgb(229 231 235 / var(--tw-bg-opacity));
}
.bg-gray-50 {
@ -1612,9 +1612,9 @@ code {
background-color: rgb(243 244 246 / var(--tw-bg-opacity));
}
.hover\:bg-gray-500:hover {
.hover\:bg-gray-300:hover {
--tw-bg-opacity: 1;
background-color: rgb(107 114 128 / var(--tw-bg-opacity));
background-color: rgb(209 213 219 / var(--tw-bg-opacity));
}
.hover\:bg-green-500:hover {

View file

@ -96,7 +96,7 @@
{{ else if eq .Status "FAILURE" }}
<span class="flex w-3 h-3 me-2 bg-red-400 rounded-full"></span>
{{ else }}
<span class="flex w-3 h-3 me-2 bg-gray-400 rounded-full"></span>
<span class="flex w-3 h-3 me-2 bg-gray-200 rounded-full"></span>
{{ end }}
<p>{{ .Name }}</p>
</div>
@ -112,7 +112,7 @@
{{ else if eq . "FAILURE" }}
<div class="bg-red-400 hover:bg-red-500 flex-auto"></div>
{{ else }}
<div class="bg-gray-400 hover:bg-gray-500 flex-auto"></div>
<div class="bg-gray-200 hover:bg-gray-300 flex-auto"></div>
{{ end }}
{{ end }}
</div>