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
Changes from 6 commits
36e3be8
f171256
6b80112
7be7958
25f05c6
2aa3b53
7302b15
35439b3
e70ec70
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
class UpdateAcademicYearWorkshopSubjects < ActiveRecord::Migration[5.0] | ||
CUTOFF_DATE = '2020-08-05' | ||
|
||
# The top 6 subjects here are straight string changes for the names of | ||
# our academic year workshops. | ||
# The "Virtual Workshop #" workshops represent regional partners | ||
# who have scheduled these "Virtual Workshop #" workshops instead of | ||
# the more traditional "Academic Year Workshop #" workshops. | ||
# This migration moves those workshops to to the more traditional | ||
# workhop naming convention. These regional partners also likely have | ||
# "Virtual Workshop 2/4/6/8" scheduled - we are working | ||
# with this limited group to manually delete or | ||
# update these workshops, as appropriate. | ||
CSD_COURSE = 'CS Discoveries'.freeze | ||
CSD_SUBJECTS = [ | ||
{from: 'Workshop 1: Unit 3', to: 'Academic Year Workshop 1'}, | ||
{from: 'Workshop 2: Unit 4', to: 'Academic Year Workshop 2'}, | ||
{from: 'Workshop 3: Unit 5', to: 'Academic Year Workshop 3'}, | ||
{from: 'Workshop 4: Unit 6', to: 'Academic Year Workshop 4'}, | ||
{from: '2-day, Workshops 1+2: Units 3 and 4', to: 'Academic Year Workshop 1 + 2'}, | ||
{from: '2-day, Workshops 3+4: Units 5 and 6', to: 'Academic Year Workshop 3 + 4'}, | ||
{from: 'Virtual Workshop 1', to: 'Academic Year Workshop 1'}, | ||
{from: 'Virtual Workshop 3', to: 'Academic Year Workshop 2'}, | ||
{from: 'Virtual Workshop 5', to: 'Academic Year Workshop 3'}, | ||
{from: 'Virtual Workshop 7', to: 'Academic Year Workshop 4'}, | ||
].freeze | ||
|
||
CSP_COURSE = 'CS Principles'.freeze | ||
CSP_SUBJECTS = [ | ||
{from: 'Workshop 1: Unit 3', to: 'Academic Year Workshop 1'}, | ||
{from: 'Workshop 2: Unit 4 and Explore Task', to: 'Academic Year Workshop 2'}, | ||
{from: 'Workshop 3: Unit 5 and Create Task', to: 'Academic Year Workshop 3'}, | ||
{from: 'Workshop 4: Unit 5 and Multiple Choice Exam', to: 'Academic Year Workshop 4'}, | ||
{from: '2-day, Workshops 1+2: Units 3-4 and Explore Task', to: 'Academic Year Workshop 1 + 2'}, | ||
{from: '2-day, Workshops 3+4: Unit 5, Create Task, and Multiple Choice Exam', to: 'Academic Year Workshop 3 + 4'}, | ||
{from: 'Virtual Workshop 1', to: 'Academic Year Workshop 1'}, | ||
{from: 'Virtual Workshop 3', to: 'Academic Year Workshop 2'}, | ||
{from: 'Virtual Workshop 5', to: 'Academic Year Workshop 3'}, | ||
{from: 'Virtual Workshop 7', to: 'Academic Year Workshop 4'}, | ||
].freeze | ||
|
||
def up | ||
CSD_SUBJECTS.each do |subject_name| | ||
csd_workshops = Pd::Workshop.where(course: CSD_COURSE, subject: subject_name[:from]). | ||
scheduled_start_on_or_after(CUTOFF_DATE) | ||
|
||
csd_workshops.each do |csd_workshop| | ||
csd_workshop.update( | ||
subject: subject_name[:to], | ||
suppress_email: true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that I don't think adding |
||
) | ||
end | ||
end | ||
|
||
CSP_SUBJECTS.each do |subject_name| | ||
csp_workshops = Pd::Workshop.where(course: CSP_COURSE, subject: subject_name[:from]). | ||
scheduled_start_on_or_after(CUTOFF_DATE) | ||
|
||
csp_workshops.each do |csp_workshop| | ||
csp_workshop.update( | ||
subject: subject_name[:to], | ||
suppress_email: true | ||
) | ||
end | ||
end | ||
end | ||
|
||
# Note this won't exactly roll back the "up" version of the migration, | ||
# as we don't know the state of suppress_email on the workshops where this | ||
# is being applied. However, we want to suppress email in | ||
# Academic Year Workshops this school year, so in the case of a problem | ||
# 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]). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch, will add comment. |
||
scheduled_start_on_or_after(CUTOFF_DATE) | ||
|
||
csd_workshops.each do |csd_workshop| | ||
csd_workshop.update(subject: subject_name[:from]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was done more efficiently in a single There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
end | ||
end | ||
|
||
CSP_SUBJECTS.each do |subject_name| | ||
csp_workshops = Pd::Workshop.where(course: CSP_COURSE, subject: subject_name[:to]). | ||
scheduled_start_on_or_after(CUTOFF_DATE) | ||
|
||
csp_workshops.each do |csp_workshop| | ||
csp_workshop.update(subject: subject_name[:from]) | ||
end | ||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,20 +19,25 @@ module SharedWorkshopConstants | |
].freeze | ||
|
||
SUBJECT_TEACHER_CON = 'Code.org TeacherCon'.freeze | ||
|
||
# Academic Year Workshop subjects shared between CSP and CSD. | ||
SUBJECT_WORKSHOP_1 = 'Academic Year Workshop 1'.freeze | ||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe rename these last two to There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
SUBJECT_WORKSHOP_6 = 'Academic Year Workshop 3 + 4'.freeze | ||
|
||
# Note: the original intent of this constant is to put subjects | ||
# in here that will be used explicitly in JS code. | ||
# See this PR for more detail: | ||
# https://github.com/code-dot-org/code-dot-org/pull/29510 | ||
SUBJECT_NAMES = { | ||
SUBJECT_CSF_101: SUBJECT_CSF_101 = 'Intro'.freeze, | ||
SUBJECT_CSF_201: SUBJECT_CSF_201 = 'Deep Dive'.freeze, | ||
SUBJECT_FIT: SUBJECT_FIT = 'Code.org Facilitator Weekend'.freeze, | ||
SUBJECT_SUMMER_WORKSHOP: SUBJECT_SUMMER_WORKSHOP = '5-day Summer'.freeze, | ||
SUBJECT_VIRTUAL_KICKOFF: SUBJECT_VIRTUAL_KICKOFF = 'Virtual Workshop Kickoff'.freeze, | ||
SUBJECT_VIRTUAL_1: SUBJECT_VIRTUAL_1 = 'Virtual Workshop 1'.freeze, | ||
SUBJECT_VIRTUAL_2: SUBJECT_VIRTUAL_2 = 'Virtual Workshop 2'.freeze, | ||
SUBJECT_VIRTUAL_3: SUBJECT_VIRTUAL_3 = 'Virtual Workshop 3'.freeze, | ||
SUBJECT_VIRTUAL_4: SUBJECT_VIRTUAL_4 = 'Virtual Workshop 4'.freeze, | ||
SUBJECT_VIRTUAL_5: SUBJECT_VIRTUAL_5 = 'Virtual Workshop 5'.freeze, | ||
SUBJECT_VIRTUAL_6: SUBJECT_VIRTUAL_6 = 'Virtual Workshop 6'.freeze, | ||
SUBJECT_VIRTUAL_7: SUBJECT_VIRTUAL_7 = 'Virtual Workshop 7'.freeze, | ||
SUBJECT_VIRTUAL_8: SUBJECT_VIRTUAL_8 = 'Virtual Workshop 8'.freeze, | ||
SUBJECT_CSP_FOR_RETURNING_TEACHERS: SUBJECT_CSP_FOR_RETURNING_TEACHERS = 'Workshop for Returning Teachers'.freeze | ||
} | ||
SUBJECTS = { | ||
|
@@ -55,44 +60,28 @@ module SharedWorkshopConstants | |
], | ||
COURSE_CSP => [ | ||
SUBJECT_CSP_SUMMER_WORKSHOP = SUBJECT_SUMMER_WORKSHOP, | ||
SUBJECT_CSP_WORKSHOP_1 = 'Workshop 1: Unit 3'.freeze, | ||
SUBJECT_CSP_WORKSHOP_2 = 'Workshop 2: Unit 4 and Explore Task'.freeze, | ||
SUBJECT_CSP_WORKSHOP_3 = 'Workshop 3: Unit 5 and Create Task'.freeze, | ||
SUBJECT_CSP_WORKSHOP_4 = 'Workshop 4: Unit 5 and Multiple Choice Exam'.freeze, | ||
SUBJECT_CSP_WORKSHOP_5 = '2-day, Workshops 1+2: Units 3-4 and Explore Task'.freeze, | ||
SUBJECT_CSP_WORKSHOP_6 = '2-day, Workshops 3+4: Unit 5, Create Task, and Multiple Choice Exam'.freeze, | ||
SUBJECT_CSP_VIRTUAL_KICKOFF = SUBJECT_VIRTUAL_KICKOFF, | ||
SUBJECT_CSP_WORKSHOP_1 = SUBJECT_WORKSHOP_1, | ||
SUBJECT_CSP_WORKSHOP_2 = SUBJECT_WORKSHOP_2, | ||
SUBJECT_CSP_WORKSHOP_3 = SUBJECT_WORKSHOP_3, | ||
SUBJECT_CSP_WORKSHOP_4 = SUBJECT_WORKSHOP_4, | ||
SUBJECT_CSP_WORKSHOP_5 = SUBJECT_WORKSHOP_5, | ||
SUBJECT_CSP_WORKSHOP_6 = SUBJECT_WORKSHOP_6, | ||
SUBJECT_CSP_TEACHER_CON = SUBJECT_TEACHER_CON, | ||
SUBJECT_CSP_FIT = SUBJECT_FIT, | ||
SUBJECT_CSP_VIRTUAL_KICKOFF = SUBJECT_VIRTUAL_KICKOFF, | ||
SUBJECT_CSP_VIRTUAL_1 = SUBJECT_VIRTUAL_1, | ||
SUBJECT_CSP_VIRTUAL_2 = SUBJECT_VIRTUAL_2, | ||
SUBJECT_CSP_VIRTUAL_3 = SUBJECT_VIRTUAL_3, | ||
SUBJECT_CSP_VIRTUAL_4 = SUBJECT_VIRTUAL_4, | ||
SUBJECT_CSP_VIRTUAL_5 = SUBJECT_VIRTUAL_5, | ||
SUBJECT_CSP_VIRTUAL_6 = SUBJECT_VIRTUAL_6, | ||
SUBJECT_CSP_VIRTUAL_7 = SUBJECT_VIRTUAL_7, | ||
SUBJECT_CSP_VIRTUAL_8 = SUBJECT_VIRTUAL_8, | ||
SUBJECT_CSP_FOR_RETURNING_TEACHERS | ||
SUBJECT_CSP_FOR_RETURNING_TEACHERS, | ||
], | ||
COURSE_CSD => [ | ||
SUBJECT_CSD_SUMMER_WORKSHOP = SUBJECT_SUMMER_WORKSHOP, | ||
SUBJECT_CSD_WORKSHOP_1 = 'Workshop 1: Unit 3'.freeze, | ||
SUBJECT_CSD_WORKSHOP_2 = 'Workshop 2: Unit 4'.freeze, | ||
SUBJECT_CSD_WORKSHOP_3 = 'Workshop 3: Unit 5'.freeze, | ||
SUBJECT_CSD_WORKSHOP_4 = 'Workshop 4: Unit 6'.freeze, | ||
SUBJECT_CSD_WORKSHOP_5 = '2-day, Workshops 1+2: Units 3 and 4'.freeze, | ||
SUBJECT_CSD_WORKSHOP_6 = '2-day, Workshops 3+4: Units 5 and 6'.freeze, | ||
SUBJECT_CSD_VIRTUAL_KICKOFF = SUBJECT_VIRTUAL_KICKOFF, | ||
SUBJECT_CSD_WORKSHOP_1 = SUBJECT_WORKSHOP_1, | ||
SUBJECT_CSD_WORKSHOP_2 = SUBJECT_WORKSHOP_2, | ||
SUBJECT_CSD_WORKSHOP_3 = SUBJECT_WORKSHOP_3, | ||
SUBJECT_CSD_WORKSHOP_4 = SUBJECT_WORKSHOP_4, | ||
SUBJECT_CSD_WORKSHOP_5 = SUBJECT_WORKSHOP_5, | ||
SUBJECT_CSD_WORKSHOP_6 = SUBJECT_WORKSHOP_6, | ||
SUBJECT_CSD_TEACHER_CON = SUBJECT_TEACHER_CON, | ||
SUBJECT_CSD_FIT = SUBJECT_FIT, | ||
SUBJECT_CSD_VIRTUAL_KICKOFF = SUBJECT_VIRTUAL_KICKOFF, | ||
SUBJECT_CSD_VIRTUAL_1 = SUBJECT_VIRTUAL_1, | ||
SUBJECT_CSD_VIRTUAL_2 = SUBJECT_VIRTUAL_2, | ||
SUBJECT_CSD_VIRTUAL_3 = SUBJECT_VIRTUAL_3, | ||
SUBJECT_CSD_VIRTUAL_4 = SUBJECT_VIRTUAL_4, | ||
SUBJECT_CSD_VIRTUAL_5 = SUBJECT_VIRTUAL_5, | ||
SUBJECT_CSD_VIRTUAL_6 = SUBJECT_VIRTUAL_6, | ||
SUBJECT_CSD_VIRTUAL_7 = SUBJECT_VIRTUAL_7, | ||
SUBJECT_CSD_VIRTUAL_8 = SUBJECT_VIRTUAL_8 | ||
], | ||
COURSE_CSF => [ | ||
SUBJECT_CSF_101, | ||
|
@@ -107,20 +96,48 @@ module SharedWorkshopConstants | |
|
||
LEGACY_SUBJECTS = { | ||
COURSE_CSP => [ | ||
LEGACY_SUBJECT_CSP_WORKSHOP_1_1920 = 'Workshop 1: Unit 3'.freeze, | ||
LEGACY_SUBJECT_CSP_WORKSHOP_2_1920 = 'Workshop 2: Unit 4 and Explore Task'.freeze, | ||
LEGACY_SUBJECT_CSP_WORKSHOP_3_1920 = 'Workshop 3: Unit 5 and Create Task'.freeze, | ||
LEGACY_SUBJECT_CSP_WORKSHOP_4_1920 = 'Workshop 4: Unit 5 and Multiple Choice Exam'.freeze, | ||
LEGACY_SUBJECT_CSP_WORKSHOP_5_1920 = '2-day, Workshops 1+2: Units 3-4 and Explore Task'.freeze, | ||
LEGACY_SUBJECT_CSP_WORKSHOP_6_1920 = '2-day, Workshops 3+4: Unit 5, Create Task, and Multiple Choice Exam'.freeze, | ||
LEGACY_SUBJECT_CSP_WORKSHOP_1 = '1-day Academic Year, Units 1 and 2'.freeze, | ||
LEGACY_SUBJECT_CSP_WORKSHOP_2 = '1-day Academic Year, Unit 3'.freeze, | ||
LEGACY_SUBJECT_CSP_WORKSHOP_3 = '1-day Academic Year, Unit 4 + Explore Prep'.freeze, | ||
LEGACY_SUBJECT_CSP_WORKSHOP_4 = '1-day Academic Year, Unit 5 + Create Prep'.freeze, | ||
LEGACY_SUBJECT_CSP_WORKSHOP_5 = '2-day Academic Year, Units 1 to 3'.freeze, | ||
LEGACY_SUBJECT_CSP_WORKSHOP_6 = '2-day Academic Year, Units 4 and 5 + AP Prep'.freeze, | ||
LEGACY_SUBJECT_CSP_VIRTUAL_1 = 'Virtual Workshop 1'.freeze, | ||
LEGACY_SUBJECT_CSP_VIRTUAL_2 = 'Virtual Workshop 2'.freeze, | ||
LEGACY_SUBJECT_CSP_VIRTUAL_3 = 'Virtual Workshop 3'.freeze, | ||
LEGACY_SUBJECT_CSP_VIRTUAL_4 = 'Virtual Workshop 4'.freeze, | ||
LEGACY_SUBJECT_CSP_VIRTUAL_5 = 'Virtual Workshop 5'.freeze, | ||
LEGACY_SUBJECT_CSP_VIRTUAL_6 = 'Virtual Workshop 6'.freeze, | ||
LEGACY_SUBJECT_CSP_VIRTUAL_7 = 'Virtual Workshop 7'.freeze, | ||
LEGACY_SUBJECT_CSP_VIRTUAL_8 = 'Virtual Workshop 8'.freeze | ||
], | ||
COURSE_CSD => [ | ||
LEGACY_SUBJECT_CSD_WORKSHOP_1_1920 = 'Workshop 1: Unit 3'.freeze, | ||
LEGACY_SUBJECT_CSD_WORKSHOP_2_1920 = 'Workshop 2: Unit 4'.freeze, | ||
LEGACY_SUBJECT_CSD_WORKSHOP_3_1920 = 'Workshop 3: Unit 5'.freeze, | ||
LEGACY_SUBJECT_CSD_WORKSHOP_4_1920 = 'Workshop 4: Unit 6'.freeze, | ||
LEGACY_SUBJECT_CSD_WORKSHOP_5_1920 = '2-day, Workshops 1+2: Units 3 and 4'.freeze, | ||
LEGACY_SUBJECT_CSD_WORKSHOP_6_1920 = '2-day, Workshops 3+4: Units 5 and 6'.freeze, | ||
LEGACY_SUBJECT_CSD_UNITS_2_3 = '1-day Academic Year, Units 1 and 2'.freeze, | ||
LEGACY_SUBJECT_CSD_UNIT_3_4 = '1-day Academic Year, Unit 3'.freeze, | ||
LEGACY_SUBJECT_CSD_UNITS_4_5 = '1-day Academic Year, Units 4 and 5'.freeze, | ||
LEGACY_SUBJECT_CSD_UNIT_6 = '1-day Academic Year, Unit 6'.freeze, | ||
LEGACY_SUBJECT_CSD_UNITS_1_3 = '2-day Academic Year, Units 1 to 3'.freeze, | ||
LEGACY_SUBJECT_CSD_UNITS_4_6 = '2-day Academic Year, Units 4 to 6'.freeze, | ||
LEGACY_SUBJECT_CSD_VIRTUAL_1 = 'Virtual Workshop 1'.freeze, | ||
LEGACY_SUBJECT_CSD_VIRTUAL_2 = 'Virtual Workshop 2'.freeze, | ||
LEGACY_SUBJECT_CSD_VIRTUAL_3 = 'Virtual Workshop 3'.freeze, | ||
LEGACY_SUBJECT_CSD_VIRTUAL_4 = 'Virtual Workshop 4'.freeze, | ||
LEGACY_SUBJECT_CSD_VIRTUAL_5 = 'Virtual Workshop 5'.freeze, | ||
LEGACY_SUBJECT_CSD_VIRTUAL_6 = 'Virtual Workshop 6'.freeze, | ||
LEGACY_SUBJECT_CSD_VIRTUAL_7 = 'Virtual Workshop 7'.freeze, | ||
LEGACY_SUBJECT_CSD_VIRTUAL_8 = 'Virtual Workshop 8'.freeze | ||
] | ||
}.freeze | ||
|
||
|
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.
should we also set the workshop to virtual if it was one of Virtual 1/3/5/7?
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.
Sounds reasonable to me!