fix stat
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Владимир Фёдоров 2023-03-11 19:00:50 +07:00
parent e959812f9e
commit 38a21e4568
1 changed files with 10 additions and 1 deletions

View File

@ -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
}