From af96c3020662bbc38e5e4426e1a8471822020d40 Mon Sep 17 00:00:00 2001 From: Hamcha Date: Sat, 13 Feb 2016 22:06:13 +0100 Subject: [PATCH] stats: Remove replies and forward --- stats/stats.go | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/stats/stats.go b/stats/stats.go index c1a1b16..b72635c 100644 --- a/stats/stats.go +++ b/stats/stats.go @@ -32,8 +32,6 @@ type Stats struct { TodayDate time.Time Today uint64 TotalCount uint64 - Replies uint64 - Forward uint64 } var stats Stats @@ -72,12 +70,6 @@ func loadStats() { // Load total messages counter stats.TotalCount = MakeUint(b.Get([]byte("count")), "global", "count") - // Load total replies counter - stats.Replies = MakeUint(b.Get([]byte("replies")), "global", "replies") - - // Load total replies counter - stats.Forward = MakeUint(b.Get([]byte("forward")), "global", "forward") - // Load hour counters b, err = tx.CreateBucketIfNotExists([]byte("hour")) if err != nil { @@ -167,8 +159,6 @@ func updateStats(message tg.APIMessage) { // DB Update flags updatetype := 0 - updatereplies := false - updateforward := false // Update total count stats.TotalCount++ @@ -239,16 +229,6 @@ func updateStats(message tg.APIMessage) { stats.ByType[MessageTypeDocument]++ updatetype = MessageTypeDocument } - // Reply - if message.ReplyTo != nil { - stats.Replies++ - updatereplies = true - } - // Forwarded message - if message.FwdUser != nil { - stats.Forward++ - updateforward = true - } // // DB Update @@ -263,19 +243,6 @@ func updateStats(message tg.APIMessage) { return err } - if updatereplies { - err = b.Put([]byte("replies"), PutUint(stats.Replies)) - if err != nil { - return err - } - } - if updateforward { - err = b.Put([]byte("forward"), PutUint(stats.Forward)) - if err != nil { - return err - } - } - // Update time counters b = tx.Bucket([]byte("hour")) err = b.Put([]byte{byte(hour)}, PutUint(stats.ByHour[hour]))