stats: Remove replies and forward

This commit is contained in:
Hamcha 2016-02-13 22:06:13 +01:00
parent 201f0ba232
commit af96c30206
1 changed files with 0 additions and 33 deletions

View File

@ -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]))