Skip to content
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

Merged
merged 1 commit into from
Jul 13, 2021

Conversation

tejal29
Copy link
Contributor

@tejal29 tejal29 commented Jul 13, 2021

relates to #6166
In #6185 missed the check to make sure the survey start date is in past.

@tejal29 tejal29 requested a review from a team as a code owner July 13, 2021 05:35
@tejal29 tejal29 requested a review from MarlonGamez July 13, 2021 05:35
@google-cla google-cla bot added the cla: yes label Jul 13, 2021
@tejal29 tejal29 changed the title Fix sruvey active logic Fix surrvey active logic Jul 13, 2021
@codecov
Copy link

codecov bot commented Jul 13, 2021

Codecov Report

Merging #6194 (17caa98) into master (db90d38) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            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     
Impacted Files Coverage Δ
pkg/skaffold/survey/config.go 65.71% <100.00%> (+1.00%) ⬆️
pkg/skaffold/docker/parse.go 87.39% <0.00%> (-0.85%) ⬇️
pkg/skaffold/util/tar.go 57.47% <0.00%> (+4.59%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update db90d38...17caa98. Read the comment docs.

@tejal29 tejal29 added this to the v1.28.0 milestone Jul 13, 2021
@briandealwis briandealwis changed the title Fix surrvey active logic Fix survey active logic Jul 13, 2021
@@ -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()))
Copy link
Member

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 😆

@briandealwis briandealwis merged commit 8d0a32f into GoogleContainerTools:master Jul 13, 2021
@tejal29 tejal29 deleted the fix_survey_active branch July 21, 2021 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants