pull/10/head
Hunter Long 2018-06-09 21:21:12 -07:00
parent ac580cf98d
commit 9e5b58f622
2 changed files with 10 additions and 1 deletions

3
go.mod
View File

@ -1,4 +1,4 @@
module github.com/hunterlong/apizer
module github.com/hunterlong/statup
require (
github.com/GeertJohan/go.rice v0.0.0-20170420135705-c02ca9a983da
@ -8,4 +8,5 @@ require (
github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1
github.com/lib/pq v0.0.0-20180523175426-90697d60dd84
golang.org/x/crypto v0.0.0-20180608092829-8ac0e0d97ce4
gopkg.in/check.v1 v1.0.0-20161208181325-20d25e280405
)

View File

@ -86,6 +86,10 @@ func (s *Service) Online24() float64 {
s.Online24Hours = 100.00
return s.Online24Hours
}
if total == 0 {
s.Online24Hours = 0
return s.Online24Hours
}
avg := float64(failed) / float64(total) * 100
s.Online24Hours = avg
return avg
@ -119,6 +123,10 @@ func (s *Service) AvgUptime() float64 {
s.TotalUptime = 100.00
return s.TotalUptime
}
if total == 0 {
s.TotalUptime = 0
return s.TotalUptime
}
percent := float64(failed) / float64(total) * 100
s.TotalUptime = percent
return percent