Navigation Menu

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

Rename Academic Year Workshop subjects #36138

Merged
merged 9 commits into from Aug 5, 2020

Conversation

bencodeorg
Copy link
Contributor

@bencodeorg bencodeorg commented Aug 4, 2020

Updated workshop subjects for 2020-21 academic year. This PR:

  • Updates workshop subjects available for partners to create new workshops to be in the format "Academic Year Workshop #" for both CSP and CSD.
  • Migrates workshop subjects for existing workshops into the newer workshop subject names.

Largely based on #30203 (PR to do something very similar from this time last year), as well as follow ups #30270 and #30264.

Note this doesn't fully deprecate the "Virtual Workshop #" subjects -- some additional cleanup is worth doing soon. A couple items to note for that cleanup:

Links

Testing story

I followed the precedent set last year in testing, namely:

  • Run up and down functions from migration code. Compare workshop counts by courses & subjects before and after executing each function.

  • UI tests: start rails server and check:

    • Subject filter values are correct, e.g. http://localhost-studio.code.org:3000/pd/workshop_dashboard/workshops/filter?course=CS+Principles&regional_partner_id=all
    • Subject values in workshop creation are correct http://localhost-studio.code.org:3000/pd/workshop_dashboard/workshops/new
    • Workshop subjects in mailer previews are correct: http://localhost-studio.code.org:3000/rails/mailers/ --> *csd* or *csp* previews.

Reviewer Checklist:

  • Tests provide adequate coverage
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Pull Request is labeled appropriately
  • Follow-up work items (including potential tech debt) are tracked and linked

scheduled_start_on_or_after(CUTOFF_DATE)

csd_workshops.each do |csd_workshop|
csd_workshop.update(subject: subject_name[:from])
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was done more efficiently in a single update_all last year -- unfortunately, suppress_email is a serialized attribute and I couldn't figure out how to easily update a non-serialized and a serialized attribute at the same time.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is fine, given the relatively small number of workshop rows.

@bencodeorg bencodeorg changed the title Rename academic year workshop subjects Rename Academic Year Workshop subjects Aug 4, 2020
@bencodeorg bencodeorg requested a review from a team August 4, 2020 16:28
csd_workshops.each do |csd_workshop|
csd_workshop.update(
subject: subject_name[:to],
suppress_email: true
Copy link
Contributor

Choose a reason for hiding this comment

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

should we also set the workshop to virtual if it was one of Virtual 1/3/5/7?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds reasonable to me!

# with subject naming we'll leave the email suppression as-is.
def down
CSD_SUBJECTS.each do |subject_name|
csd_workshops = Pd::Workshop.where(course: CSD_COURSE, subject: subject_name[:to]).
Copy link
Contributor

Choose a reason for hiding this comment

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

this will make it so all workshops go back to 'Workshop x: Unit y' format, right? Since those are first in the list? It's probably ok, but would be good to call out

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, will add comment.

csd_workshops.each do |csd_workshop|
csd_workshop.update(
subject: subject_name[:to],
suppress_email: true
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that I don't think adding suppress_email is strictly necessary here, as I think we trigger sending updates in the update controller action, which wouldn't get called in this case? We have a follow-up to have all AYW suppress email though, so I figured it couldn't hurt.

SUBJECT_WORKSHOP_2 = 'Academic Year Workshop 2'.freeze
SUBJECT_WORKSHOP_3 = 'Academic Year Workshop 3'.freeze
SUBJECT_WORKSHOP_4 = 'Academic Year Workshop 4'.freeze
SUBJECT_WORKSHOP_5 = 'Academic Year Workshop 1 + 2'.freeze
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe rename these last two to SUBJECT_WORKSHOP_1_2 and SUBJECT_WORKSHOP_3_4? 5 and 6 are a little confusing.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah I see we used the 1-6 version last year. I think we can be more explicit this year since the names are simpler

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah agree these are confusing, I wasn't 100% confident in my find and replace for these as they get moved into JS constants as well, so I kind of kicked the can. I can update though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you think maybe there's a benefit to leaving as-is, such that they're tied to the LEGACY_SUBJECT_CSP_WORKSHOP_1, etc? Or could change the names of the legacy variables as well...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Meh actually looks like we've updated these variable names a few times, so not sure there's much historical continuity to maintain. I'll just try to do what makes sense for now.

@bencodeorg
Copy link
Contributor Author

@molly-moen made some updates to hopefully address your comments. Take another look when you have a chance!

Copy link
Contributor

@molly-moen molly-moen left a comment

Choose a reason for hiding this comment

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

Looks good, one final comment 😄

@@ -47,6 +47,7 @@ def up
csd_workshops.each do |csd_workshop|
csd_workshop.update(
subject: subject_name[:to],
virtual: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

this will always set to virtual right? I think we should only do that if it's one of virtual 1/3/5/7

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤦 yes, thanks!

Copy link
Contributor

@islemaster islemaster left a comment

Choose a reason for hiding this comment

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

👍 This looks great!

@bencodeorg bencodeorg merged commit a221f77 into staging Aug 5, 2020
@bencodeorg bencodeorg deleted the rename-academic-year-workshop-subjects branch August 5, 2020 16:26
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.

None yet

3 participants