Compare commits

1 Commits

Author SHA1 Message Date
lerko 335b39893f chore: add bug report and feature request issue templates
CI / test (pull_request) Failing after 2m28s
CI / lint (pull_request) Successful in 56s
CI / vulncheck (pull_request) Successful in 51s
2026-06-04 20:28:42 -04:00
3 changed files with 5 additions and 5 deletions
+2 -1
View File
@@ -127,7 +127,8 @@ func ComputeSLA(changes []models.StateChange, currentStatus string, window time.
return report
}
func ComputeDailyBreakdown(changes []models.StateChange, currentStatus string, days int, now time.Time) []DayReport {
func ComputeDailyBreakdown(changes []models.StateChange, currentStatus string, days int) []DayReport {
now := time.Now()
reports := make([]DayReport, days)
for i := 0; i < days; i++ {
+2 -3
View File
@@ -118,14 +118,13 @@ func TestComputeSLA_LateNotDown(t *testing.T) {
}
func TestComputeDailyBreakdown(t *testing.T) {
// Use a fixed time well past midnight so the outage always falls within today's window.
now := time.Date(2026, 6, 4, 15, 0, 0, 0, time.UTC)
now := time.Now()
changes := []models.StateChange{
{ToStatus: "UP", ChangedAt: now.Add(-1 * time.Hour)},
{ToStatus: "DOWN", FromStatus: "UP", ChangedAt: now.Add(-2 * time.Hour)},
}
days := ComputeDailyBreakdown(changes, "UP", 7, now)
days := ComputeDailyBreakdown(changes, "UP", 7)
if len(days) != 7 {
t.Fatalf("expected 7 days, got %d", len(days))
+1 -1
View File
@@ -329,7 +329,7 @@ func (m *Model) recomputeSLA() {
}
m.slaReport = monitor.ComputeSLA(changes, currentStatus, period.duration)
m.slaDailyBreakdown = monitor.ComputeDailyBreakdown(changes, currentStatus, period.days, time.Now())
m.slaDailyBreakdown = monitor.ComputeDailyBreakdown(changes, currentStatus, period.days)
m.slaViewport = viewport.New(
m.termWidth-chromePadH,