Isrolling fixes and add tests

This commit is contained in:
johan-autohome 2025-01-03 19:11:50 +01:00
parent 11f1985831
commit 015aeba0c2
3 changed files with 97 additions and 15 deletions

View file

@ -24,14 +24,14 @@ func scheduleNextDueDate(chore *chModel.Chore, completedDate time.Time) (*time.T
return nil, nil
}
if chore.NextDueDate != nil {
if chore.NextDueDate != nil && !chore.IsRolling {
// no due date set, use the current date
baseDate = chore.NextDueDate.UTC()
} else {
baseDate = completedDate.UTC()
}
if chore.FrequencyType == "day_of_the_month" || chore.FrequencyType == "days_of_the_week" || chore.FrequencyType == "interval" {
if !chore.IsRolling && (chore.FrequencyType == "day_of_the_month" || chore.FrequencyType == "days_of_the_week" || chore.FrequencyType == "interval") {
// time in frequency metadata stored as RFC3339 format like `2024-07-07T13:27:00-04:00`
// parse it to time.Time:
t, err := time.Parse(time.RFC3339, frequencyMetadata.Time)