diff --git a/model/service.go b/model/service.go index 428cf45..bcf9e7c 100644 --- a/model/service.go +++ b/model/service.go @@ -33,3 +33,17 @@ type Service struct { func (Service) TableName() string { return "service" } + +func (s Service) CountLastStatuses(status StatusCode) uint { + var count uint = 0 + + for i := range s.Statuses { + if s.Statuses[i].Status != status { + break + } + + count++ + } + + return count +}