File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,6 +26,11 @@ func (h CheckinHitters) Count() int {
2626 return count
2727}
2828
29+ func (h CheckinHitters ) Since (t time.Time ) CheckinHitters {
30+ timestamp := db .FormatTime (t )
31+ return CheckinHitters {h .db .Where ("checkin_hits.created_at > ?" , timestamp )}
32+ }
33+
2934func (c * Checkin ) LastHit () * CheckinHit {
3035 var hit CheckinHit
3136 dbHits .Where ("checkin = ?" , c .Id ).Last (& hit )
@@ -57,8 +62,3 @@ func (c *CheckinHit) Delete() error {
5762func AllCheckinHits (serviceId int64 ) CheckinHitters {
5863 return CheckinHitters {dbHits .Joins ("JOIN checkins ON checkins.id = checkin" ).Where ("checkins.service = ?" , serviceId ).Order ("checkin_hits.id DESC" )}
5964}
60-
61- func CheckinHitsSince (serviceId int64 , t time.Time ) CheckinHitters {
62- timestamp := db .FormatTime (t )
63- return CheckinHitters {AllCheckinHits (serviceId ).db .Where ("checkin_hits.created_at > ?" , timestamp )}
64- }
Original file line number Diff line number Diff line change @@ -34,7 +34,3 @@ func (s *Service) FirstCheckinHit() *checkins.CheckinHit {
3434func (s * Service ) HitsSince (t time.Time ) hits.Hitters {
3535 return hits .Since (t , s )
3636}
37-
38- func (s * Service ) CheckinHitsSince (t time.Time ) checkins.CheckinHitters {
39- return checkins .CheckinHitsSince (s .Id , t )
40- }
Original file line number Diff line number Diff line change @@ -278,7 +278,7 @@ func (s Service) OnlineDaysPercent(days int) float32 {
278278func (s * Service ) OnlineSince (ago time.Time ) float32 {
279279 failsCount := s .FailuresSince (ago ).Count ()
280280 hitsCount := s .HitsSince (ago ).Count ()
281- checkinHitsCount := s .CheckinHitsSince (ago ).Count ()
281+ checkinHitsCount := s .AllCheckinHits (). Since (ago ).Count ()
282282
283283 if failsCount == 0 {
284284 s .Online24Hours = 100.00
You can’t perform that action at this time.
0 commit comments