Review reminder script: fix another edge case on the date the sprint
authorWard Vandewege <ward@curii.com>
Wed, 16 Mar 2022 14:25:36 +0000 (10:25 -0400)
committerWard Vandewege <ward@curii.com>
Wed, 16 Mar 2022 14:25:36 +0000 (10:25 -0400)
turns over.

refs #18813

Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward@curii.com>

cmd/review-task-reminder/root.go

index 4838ba2e064ae30c61a769cc6358540499629ff7..9d3ab57bb06f87bd61c4c1e7b1eb8002a7a51db4 100644 (file)
@@ -153,6 +153,7 @@ https://git.arvados.org/arvados-dev.git/cmd/review-task-reminder` +
                if err != nil {
                        log.Fatalf(err.Error())
                }
+               now := time.Date(time.Now().Year(), time.Now().Month(), time.Now().Day(), 0, 0, 0, 0, time.UTC)
                // Find any current sprint(s)
                for _, v := range versions {
                        // It must be "open"
@@ -167,7 +168,7 @@ https://git.arvados.org/arvados-dev.git/cmd/review-task-reminder` +
                        if err != nil {
                                log.Fatalf(err.Error())
                        }
-                       if time.Now().After(dueDate) {
+                       if dueDate.Before(now) {
                                continue
                        }
                        // The start date must be in the past (have to look up the Sprint object!)
@@ -183,7 +184,7 @@ https://git.arvados.org/arvados-dev.git/cmd/review-task-reminder` +
                        if err != nil {
                                log.Fatalf(err.Error())
                        }
-                       if time.Now().Before(startDate) {
+                       if startDate.After(now) {
                                continue
                        }
                        // Found a current sprint