feat(model): Add method for getting count of last statuses
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user