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
8 changes: 4 additions & 4 deletions dashboard/app/models/pd/workshop_constants.rb
Expand Up @@ -61,8 +61,8 @@ module WorkshopConstants
SUBJECT_CSP_WORKSHOP_2 => {min_days: 1, max_days: 1, max_hours: 6},
SUBJECT_CSP_WORKSHOP_3 => {min_days: 1, max_days: 1, max_hours: 6},
SUBJECT_CSP_WORKSHOP_4 => {min_days: 1, max_days: 1, max_hours: 6},
SUBJECT_CSP_WORKSHOP_5 => {min_days: 2, max_days: 2, max_hours: 12},
SUBJECT_CSP_WORKSHOP_6 => {min_days: 2, max_days: 2, max_hours: 12},
SUBJECT_CSP_WORKSHOP_1_2 => {min_days: 2, max_days: 2, max_hours: 12},
SUBJECT_CSP_WORKSHOP_3_4 => {min_days: 2, max_days: 2, max_hours: 12},
SUBJECT_CSP_TEACHER_CON => {max_hours: 33.5},
SUBJECT_CSP_FOR_RETURNING_TEACHERS => {max_hours: 7}
},
Expand All @@ -72,8 +72,8 @@ module WorkshopConstants
SUBJECT_CSD_WORKSHOP_2 => {min_days: 1, max_days: 1, max_hours: 6},
SUBJECT_CSD_WORKSHOP_3 => {min_days: 1, max_days: 1, max_hours: 6},
SUBJECT_CSD_WORKSHOP_4 => {min_days: 1, max_days: 1, max_hours: 6},
SUBJECT_CSD_WORKSHOP_5 => {min_days: 2, max_days: 2, max_hours: 12},
SUBJECT_CSD_WORKSHOP_6 => {min_days: 2, max_days: 2, max_hours: 12},
SUBJECT_CSD_WORKSHOP_1_2 => {min_days: 2, max_days: 2, max_hours: 12},
SUBJECT_CSD_WORKSHOP_3_4 => {min_days: 2, max_days: 2, max_hours: 12},
SUBJECT_CSD_TEACHER_CON => {max_hours: 33.5}
},
COURSE_CSF => {
Expand Down
Expand Up @@ -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!

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!

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.

)
end
Expand All @@ -59,6 +60,7 @@ def up
csp_workshops.each do |csp_workshop|
csp_workshop.update(
subject: subject_name[:to],
virtual: true,
suppress_email: true
)
end
Expand All @@ -70,6 +72,8 @@ def up
# 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.
# It also will rename subjects originally named "Virtual Workshop #"
# to "Workshop 1: Unit 3", which we think is ok in this situation.
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.

Expand Down
40 changes: 27 additions & 13 deletions dashboard/lib/pd/workshop_survey_constants.rb
Expand Up @@ -30,17 +30,35 @@ module WorkshopSurveyConstants
SUBJECT_CSP_WORKSHOP_2 => ACADEMIC_YEAR_2_CATEGORY,
SUBJECT_CSP_WORKSHOP_3 => ACADEMIC_YEAR_3_CATEGORY,
SUBJECT_CSP_WORKSHOP_4 => ACADEMIC_YEAR_4_CATEGORY,
SUBJECT_CSP_WORKSHOP_5 => ACADEMIC_YEAR_1_2_CATEGORY,
SUBJECT_CSP_WORKSHOP_6 => ACADEMIC_YEAR_3_4_CATEGORY,
SUBJECT_CSP_WORKSHOP_1_2 => ACADEMIC_YEAR_1_2_CATEGORY,
SUBJECT_CSP_WORKSHOP_3_4 => ACADEMIC_YEAR_3_4_CATEGORY,
SUBJECT_CSP_TEACHER_CON => LOCAL_CATEGORY,

SUBJECT_CSD_SUMMER_WORKSHOP => LOCAL_CATEGORY,
SUBJECT_CSD_WORKSHOP_1 => ACADEMIC_YEAR_1_CATEGORY,
SUBJECT_CSD_WORKSHOP_2 => ACADEMIC_YEAR_2_CATEGORY,
SUBJECT_CSD_WORKSHOP_3 => ACADEMIC_YEAR_3_CATEGORY,
SUBJECT_CSD_WORKSHOP_4 => ACADEMIC_YEAR_4_CATEGORY,
SUBJECT_CSD_WORKSHOP_1_2 => ACADEMIC_YEAR_1_2_CATEGORY,
SUBJECT_CSD_WORKSHOP_3_4 => ACADEMIC_YEAR_3_4_CATEGORY,
SUBJECT_CSD_TEACHER_CON => LOCAL_CATEGORY,

SUBJECT_CSF_201 => CSF_CATEGORY,

LEGACY_SUBJECT_CSP_WORKSHOP_1 => ACADEMIC_YEAR_1_CATEGORY,
LEGACY_SUBJECT_CSP_WORKSHOP_2 => ACADEMIC_YEAR_2_CATEGORY,
LEGACY_SUBJECT_CSP_WORKSHOP_3 => ACADEMIC_YEAR_3_CATEGORY,
LEGACY_SUBJECT_CSP_WORKSHOP_4 => ACADEMIC_YEAR_4_CATEGORY,
LEGACY_SUBJECT_CSP_WORKSHOP_5 => ACADEMIC_YEAR_1_2_CATEGORY,
LEGACY_SUBJECT_CSP_WORKSHOP_6 => ACADEMIC_YEAR_3_4_CATEGORY,

LEGACY_SUBJECT_CSP_WORKSHOP_1_1920 => ACADEMIC_YEAR_1_CATEGORY,
LEGACY_SUBJECT_CSP_WORKSHOP_2_1920 => ACADEMIC_YEAR_2_CATEGORY,
LEGACY_SUBJECT_CSP_WORKSHOP_3_1920 => ACADEMIC_YEAR_3_CATEGORY,
LEGACY_SUBJECT_CSP_WORKSHOP_4_1920 => ACADEMIC_YEAR_4_CATEGORY,
LEGACY_SUBJECT_CSP_WORKSHOP_5_1920 => ACADEMIC_YEAR_1_2_CATEGORY,
LEGACY_SUBJECT_CSP_WORKSHOP_6_1920 => ACADEMIC_YEAR_3_4_CATEGORY,

LEGACY_SUBJECT_CSP_VIRTUAL_1 => VIRTUAL_1_CATEGORY,
LEGACY_SUBJECT_CSP_VIRTUAL_2 => VIRTUAL_2_CATEGORY,
LEGACY_SUBJECT_CSP_VIRTUAL_3 => VIRTUAL_3_CATEGORY,
Expand All @@ -50,22 +68,20 @@ module WorkshopSurveyConstants
LEGACY_SUBJECT_CSP_VIRTUAL_7 => VIRTUAL_7_CATEGORY,
LEGACY_SUBJECT_CSP_VIRTUAL_8 => VIRTUAL_8_CATEGORY,

SUBJECT_CSD_SUMMER_WORKSHOP => LOCAL_CATEGORY,
SUBJECT_CSD_WORKSHOP_1 => ACADEMIC_YEAR_1_CATEGORY,
SUBJECT_CSD_WORKSHOP_2 => ACADEMIC_YEAR_2_CATEGORY,
SUBJECT_CSD_WORKSHOP_3 => ACADEMIC_YEAR_3_CATEGORY,
SUBJECT_CSD_WORKSHOP_4 => ACADEMIC_YEAR_4_CATEGORY,
SUBJECT_CSD_WORKSHOP_5 => ACADEMIC_YEAR_1_2_CATEGORY,
SUBJECT_CSD_WORKSHOP_6 => ACADEMIC_YEAR_3_4_CATEGORY,
SUBJECT_CSD_TEACHER_CON => LOCAL_CATEGORY,

LEGACY_SUBJECT_CSD_UNITS_2_3 => ACADEMIC_YEAR_1_CATEGORY,
LEGACY_SUBJECT_CSD_UNIT_3_4 => ACADEMIC_YEAR_2_CATEGORY,
LEGACY_SUBJECT_CSD_UNITS_4_5 => ACADEMIC_YEAR_3_CATEGORY,
LEGACY_SUBJECT_CSD_UNIT_6 => ACADEMIC_YEAR_4_CATEGORY,
LEGACY_SUBJECT_CSD_UNITS_1_3 => ACADEMIC_YEAR_1_2_CATEGORY,
LEGACY_SUBJECT_CSD_UNITS_4_6 => ACADEMIC_YEAR_3_4_CATEGORY,

LEGACY_SUBJECT_CSD_WORKSHOP_1_1920 => ACADEMIC_YEAR_1_CATEGORY,
LEGACY_SUBJECT_CSD_WORKSHOP_2_1920 => ACADEMIC_YEAR_2_CATEGORY,
LEGACY_SUBJECT_CSD_WORKSHOP_3_1920 => ACADEMIC_YEAR_3_CATEGORY,
LEGACY_SUBJECT_CSD_WORKSHOP_4_1920 => ACADEMIC_YEAR_4_CATEGORY,
LEGACY_SUBJECT_CSD_WORKSHOP_5_1920 => ACADEMIC_YEAR_1_2_CATEGORY,
LEGACY_SUBJECT_CSD_WORKSHOP_6_1920 => ACADEMIC_YEAR_3_4_CATEGORY,

LEGACY_SUBJECT_CSD_VIRTUAL_1 => VIRTUAL_1_CATEGORY,
LEGACY_SUBJECT_CSD_VIRTUAL_2 => VIRTUAL_2_CATEGORY,
LEGACY_SUBJECT_CSD_VIRTUAL_3 => VIRTUAL_3_CATEGORY,
Expand All @@ -74,8 +90,6 @@ module WorkshopSurveyConstants
LEGACY_SUBJECT_CSD_VIRTUAL_6 => VIRTUAL_6_CATEGORY,
LEGACY_SUBJECT_CSD_VIRTUAL_7 => VIRTUAL_7_CATEGORY,
LEGACY_SUBJECT_CSD_VIRTUAL_8 => VIRTUAL_8_CATEGORY,

SUBJECT_CSF_201 => CSF_CATEGORY,
}

CSF_SURVEY_NAMES = [
Expand Down
20 changes: 10 additions & 10 deletions dashboard/test/factories/workshop_factories.rb
@@ -1,10 +1,10 @@
# Most academic year workshops are one day workshops.
# These specific workshop types are two day workshops.
TWO_DAY_AYW_SUBJECTS = [
Pd::Workshop::SUBJECT_CSD_WORKSHOP_5,
Pd::Workshop::SUBJECT_CSD_WORKSHOP_6,
Pd::Workshop::SUBJECT_CSP_WORKSHOP_5,
Pd::Workshop::SUBJECT_CSP_WORKSHOP_6
Pd::Workshop::SUBJECT_CSD_WORKSHOP_1_2,
Pd::Workshop::SUBJECT_CSD_WORKSHOP_3_4,
Pd::Workshop::SUBJECT_CSP_WORKSHOP_1_2,
Pd::Workshop::SUBJECT_CSP_WORKSHOP_3_4
]

#
Expand Down Expand Up @@ -164,9 +164,9 @@
trait :two_day do
subject do
if course == Pd::Workshop::COURSE_CSP
Pd::Workshop::SUBJECT_CSP_WORKSHOP_5
Pd::Workshop::SUBJECT_CSP_WORKSHOP_1_2
else
Pd::Workshop::SUBJECT_CSD_WORKSHOP_5
Pd::Workshop::SUBJECT_CSD_WORKSHOP_1_2
end
end
end
Expand All @@ -187,8 +187,8 @@
# Pd::Workshop::SUBJECT_CSP_WORKSHOP_2
# Pd::Workshop::SUBJECT_CSP_WORKSHOP_3
# Pd::Workshop::SUBJECT_CSP_WORKSHOP_4
# Pd::Workshop::SUBJECT_CSP_WORKSHOP_5 (2-day)
# Pd::Workshop::SUBJECT_CSP_WORKSHOP_6 (2-day)
# Pd::Workshop::SUBJECT_CSP_WORKSHOP_1_2 (2-day)
# Pd::Workshop::SUBJECT_CSP_WORKSHOP_3_4 (2-day)
subject Pd::Workshop::SUBJECT_CSP_WORKSHOP_1
end
factory(:csp_academic_year_workshop) {csp}
Expand All @@ -203,8 +203,8 @@
# Pd::Workshop::SUBJECT_CSD_WORKSHOP_2
# Pd::Workshop::SUBJECT_CSD_WORKSHOP_3
# Pd::Workshop::SUBJECT_CSD_WORKSHOP_4
# Pd::Workshop::SUBJECT_CSD_WORKSHOP_5 (2-day)
# Pd::Workshop::SUBJECT_CSD_WORKSHOP_6 (2-day)
# Pd::Workshop::SUBJECT_CSD_WORKSHOP_1_2 (2-day)
# Pd::Workshop::SUBJECT_CSD_WORKSHOP_3_4 (2-day)
subject Pd::Workshop::SUBJECT_CSD_WORKSHOP_1
end
factory(:csd_academic_year_workshop) {csd}
Expand Down
16 changes: 10 additions & 6 deletions lib/cdo/shared_constants/pd/shared_workshop_constants.rb
Expand Up @@ -25,8 +25,8 @@ module SharedWorkshopConstants
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
SUBJECT_WORKSHOP_6 = 'Academic Year Workshop 3 + 4'.freeze
SUBJECT_WORKSHOP_1_2 = 'Academic Year Workshop 1 + 2'.freeze
SUBJECT_WORKSHOP_3_4 = '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.
Expand Down Expand Up @@ -65,8 +65,8 @@ module SharedWorkshopConstants
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_WORKSHOP_1_2 = SUBJECT_WORKSHOP_1_2,
SUBJECT_CSP_WORKSHOP_3_4 = SUBJECT_WORKSHOP_3_4,
SUBJECT_CSP_TEACHER_CON = SUBJECT_TEACHER_CON,
SUBJECT_CSP_FIT = SUBJECT_FIT,
SUBJECT_CSP_FOR_RETURNING_TEACHERS,
Expand All @@ -78,8 +78,8 @@ module SharedWorkshopConstants
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_WORKSHOP_1_2 = SUBJECT_WORKSHOP_1_2,
SUBJECT_CSD_WORKSHOP_3_4 = SUBJECT_WORKSHOP_3_4,
SUBJECT_CSD_TEACHER_CON = SUBJECT_TEACHER_CON,
SUBJECT_CSD_FIT = SUBJECT_FIT,
],
Expand All @@ -102,12 +102,14 @@ module SharedWorkshopConstants
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,
Expand All @@ -124,12 +126,14 @@ module SharedWorkshopConstants
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,
Expand Down