-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix survey active logic #6194
Fix survey active logic #6194
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6194 +/- ##
==========================================
+ Coverage 71.08% 71.09% +0.01%
==========================================
Files 485 485
Lines 21603 21604 +1
==========================================
+ Hits 15356 15359 +3
+ Misses 5264 5263 -1
+ Partials 983 982 -1
Continue to review full report at Codecov.
|
@@ -60,7 +60,8 @@ type config struct { | |||
} | |||
|
|||
func (s config) isActive() bool { | |||
return s.expiresAt.IsZero() || s.expiresAt.After(time.Now()) | |||
return s.expiresAt.IsZero() || | |||
(s.startsAt.Before(time.Now()) && s.expiresAt.After(time.Now())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Funny: I found this really hard to reason through — we must think of time differently!
I'd have written this as "we're after the start and before the end":
time.Now().After(s.startsAt) && time.Now().Before(s.expiresAt)
though there's a small boundary condition there that your formulation deals with 😆
relates to #6166
In #6185 missed the check to make sure the survey start date is in past.