stats: Remove replies and forward
This commit is contained in:
parent
201f0ba232
commit
af96c30206
1 changed files with 0 additions and 33 deletions
|
@ -32,8 +32,6 @@ type Stats struct {
|
||||||
TodayDate time.Time
|
TodayDate time.Time
|
||||||
Today uint64
|
Today uint64
|
||||||
TotalCount uint64
|
TotalCount uint64
|
||||||
Replies uint64
|
|
||||||
Forward uint64
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var stats Stats
|
var stats Stats
|
||||||
|
@ -72,12 +70,6 @@ func loadStats() {
|
||||||
// Load total messages counter
|
// Load total messages counter
|
||||||
stats.TotalCount = MakeUint(b.Get([]byte("count")), "global", "count")
|
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
|
// Load hour counters
|
||||||
b, err = tx.CreateBucketIfNotExists([]byte("hour"))
|
b, err = tx.CreateBucketIfNotExists([]byte("hour"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -167,8 +159,6 @@ func updateStats(message tg.APIMessage) {
|
||||||
|
|
||||||
// DB Update flags
|
// DB Update flags
|
||||||
updatetype := 0
|
updatetype := 0
|
||||||
updatereplies := false
|
|
||||||
updateforward := false
|
|
||||||
|
|
||||||
// Update total count
|
// Update total count
|
||||||
stats.TotalCount++
|
stats.TotalCount++
|
||||||
|
@ -239,16 +229,6 @@ func updateStats(message tg.APIMessage) {
|
||||||
stats.ByType[MessageTypeDocument]++
|
stats.ByType[MessageTypeDocument]++
|
||||||
updatetype = MessageTypeDocument
|
updatetype = MessageTypeDocument
|
||||||
}
|
}
|
||||||
// Reply
|
|
||||||
if message.ReplyTo != nil {
|
|
||||||
stats.Replies++
|
|
||||||
updatereplies = true
|
|
||||||
}
|
|
||||||
// Forwarded message
|
|
||||||
if message.FwdUser != nil {
|
|
||||||
stats.Forward++
|
|
||||||
updateforward = true
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// DB Update
|
// DB Update
|
||||||
|
@ -263,19 +243,6 @@ func updateStats(message tg.APIMessage) {
|
||||||
return err
|
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
|
// Update time counters
|
||||||
b = tx.Bucket([]byte("hour"))
|
b = tx.Bucket([]byte("hour"))
|
||||||
err = b.Put([]byte{byte(hour)}, PutUint(stats.ByHour[hour]))
|
err = b.Put([]byte{byte(hour)}, PutUint(stats.ByHour[hour]))
|
||||||
|
|
Reference in a new issue