fix stat
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
e959812f9e
commit
38a21e4568
11
db/db.go
11
db/db.go
|
@ -154,8 +154,17 @@ func GetStat(chatID int64) (map[string]int, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
loc, _ := time.LoadLocation("Asia/Novosibirsk")
|
||||
t := time.Now().In(loc).Add(-24 * time.Hour)
|
||||
|
||||
collection := client.Database(cfg.DBName).Collection(cfg.WorkoutsCollectionName)
|
||||
cursor, err := collection.Find(ctx, bson.M{"chat_id": chatID})
|
||||
cursor, err := collection.Find(
|
||||
ctx,
|
||||
bson.M{
|
||||
"chat_id": chatID,
|
||||
"created_at": bson.M{"$gt": t},
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue