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 rollout timeline/pop page fixes #2403 #2406

Merged
merged 4 commits into from
Mar 19, 2020

Conversation

uhlissuh
Copy link
Contributor

Screen Shot 2020-03-19 at 11 12 41 AM

@uhlissuh uhlissuh requested a review from jaredlockhart March 19, 2020 18:15
Copy link
Collaborator

@jaredlockhart jaredlockhart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try splitting those two methods, I'm gonna try testing this locally....

*edit: but otherwise looks perfect 👍

@@ -94,6 +96,49 @@ class TimelinePopForm extends React.PureComponent {
}
}

displayRolloutPlaybookOrEnrollment() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather split this into two things like

displayRolloutPlaybook
displayEnrollmentDuration

and then inside each one just start with the bool check about whether it should show

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do.

@uhlissuh uhlissuh requested a review from jaredlockhart March 19, 2020 18:40
Comment on lines 136 to 140
<option>Rollout Playbook</option>
<option>Low Risk Schedule</option>
<option>High Risk Schedule</option>
<option>Marketing Launch Schedule</option>
<option>Custom Schedule</option>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh shouldn't these be

  1. in the js constants file
  2. those are the display strings but don't the options also need the string values (the lower case ones) here? https://github.com/mozilla/experimenter/blob/master/app/experimenter/experiments/constants.py#L25-L35

Copy link
Contributor Author

@uhlissuh uhlissuh Mar 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jaredlockhart you'd like to see if more how I did the firefox versions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I just put the value into every option and that works, however I can refactor it to look more like firefox versions, where there's a function that format's each option withwhat's in the JS constants file.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oooohhh I see what's happening here.

The fields in the database are charfields, so they'll accept anything, so anything you put in there is valid and will just get saved and displayed.

Usually in Django world you define two things, a db value and a display value, and then define the pair as CHOICES, example:

https://github.com/mozilla/experimenter/blob/master/app/experimenter/experiments/constants.py#L10-L20

Then later when you're dealing with the field in code somewhere, you're comparing against the db value not the display value.

We didn't notice because a bunch of these things just only stay as text and we never refer to teh values in code, we just take wahtever it is and display it on the detail page, and the db values and display values are the same, like for platform:

https://github.com/mozilla/experimenter/blob/master/app/experimenter/experiments/constants.py#L152-L157

So yes exactly it should be like the way versions are done, and actually the real fix here is to change the serializer to use a ChoiceField instead of a CharField so it actually checks that the values are from the list we expect, but I think we can do that as a followup ticket so we don't blow this one up.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Followup: #2407

Copy link
Contributor Author

@uhlissuh uhlissuh Mar 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jaredlockhart ok I've made the change to where the playbook options are in constants and then they are displayed with the function displayOptions, which is a generalized version of a function that used to just be formatting the versions options... but is now formatting versions and playbook options.

@uhlissuh
Copy link
Contributor Author

Screen Shot 2020-03-19 at 12 05 39 PM

now you can see that high-risk is being saved correctly in DB and displaying the right graph.

@uhlissuh uhlissuh requested a review from jaredlockhart March 19, 2020 19:19
Copy link
Collaborator

@jaredlockhart jaredlockhart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome just tried locally and works perfectly, thank you for the fast fix and updates from feedback, the displayOptions is very clean and elegant, I love it! Great job @uhlissuh 😄 🎉

@uhlissuh uhlissuh merged commit bd166e9 into mozilla:master Mar 19, 2020
tiftran pushed a commit to tiftran/experimenter that referenced this pull request Mar 20, 2020
* Fix rollout timeline/pop page fixes mozilla#2403

* Split into two methods of enrollment and playbook

* Add values to options

Co-authored-by: Jared Lockhart <119884+jaredlockhart@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants