diff --git a/db/db.go b/db/db.go index 075c2b0..fa3a435 100644 --- a/db/db.go +++ b/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 }