add week stat
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-04-09 14:15:53 +07:00
parent c3d00b5dec
commit d1f2c359a2
2 changed files with 37 additions and 11 deletions
+1 -5
View File
@@ -125,17 +125,13 @@ func (db *DB) SetPause(chatID int64, duration time.Duration) error {
return err
}
func (db *DB) GetStat(chatID int64) (map[string]int, error) {
func (db *DB) GetStatAfter(chatID int64, t time.Time) (map[string]int, error) {
ctx := context.Background()
if err := db.AddChat(chatID); err != nil {
return nil, err
}
loc, _ := time.LoadLocation("Asia/Novosibirsk")
t := time.Now().In(loc)
t = time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, loc)
res := map[string]int{}
cursor, err := db.workoutsColection.Find(