Skip to content

Commit

Permalink
Merge pull request #45595 from code-dot-org/dtp_candidate_a717eb3b
Browse files Browse the repository at this point in the history
DTP (Test > Production: a717eb3)
  • Loading branch information
breville committed Mar 31, 2022
2 parents 9606883 + ae6f1b7 commit 0dcedf6
Show file tree
Hide file tree
Showing 1,048 changed files with 134,987 additions and 4,911 deletions.
115 changes: 106 additions & 9 deletions apps/src/templates/teacherDashboard/teacherDashboardTestHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,13 @@ export const courseOfferings = {
display_name: 'Course A',
category: 'csf',
is_featured: false,
participant_audience: 'student',
course_versions: {
1: {
id: 1,
key: '2017',
version_year: '2017',
content_root_id: 10,
content_root_id: 1,
name: 'Course A',
path: '/s/coursea-2017',
type: 'Script',
Expand All @@ -117,7 +118,7 @@ export const courseOfferings = {
id: 2,
key: '2018',
version_year: '2018',
content_root_id: 11,
content_root_id: 2,
name: 'Course A',
path: '/s/coursea-2018',
type: 'Script',
Expand All @@ -141,12 +142,13 @@ export const courseOfferings = {
display_name: 'Computer Science Discoveries',
category: 'full_course',
is_featured: false,
participant_audience: 'student',
course_versions: {
3: {
id: 3,
key: '2017',
version_year: "'17-'18",
content_root_id: 12,
content_root_id: 52,
name: 'CS Discoveries 2017',
path: '/courses/csd-2017',
type: 'UnitGroup',
Expand Down Expand Up @@ -176,7 +178,7 @@ export const courseOfferings = {
id: 4,
key: '2018',
version_year: "'18-'19",
content_root_id: 13,
content_root_id: 51,
name: 'CS Discoveries 2018',
path: '/courses/csd-2018',
type: 'UnitGroup',
Expand Down Expand Up @@ -209,12 +211,13 @@ export const courseOfferings = {
display_name: 'Computer Science A',
category: 'full_course',
is_featured: false,
participant_audience: 'student',
course_versions: {
5: {
id: 5,
key: '2022',
version_year: '2022',
content_root_id: 14,
content_root_id: 50,
name: 'CS A',
path: '/courses/csa-2022',
type: 'UnitGroup',
Expand Down Expand Up @@ -247,12 +250,13 @@ export const courseOfferings = {
display_name: 'Flappy',
category: 'hoc',
is_featured: false,
participant_audience: 'student',
course_versions: {
6: {
id: 6,
key: 'unversioned',
version_year: 'unversioned',
content_root_id: 15,
content_root_id: 9,
name: 'Flappy',
path: '/s/flappy',
type: 'Script',
Expand Down Expand Up @@ -282,7 +286,7 @@ export const courseOfferings = {
id: 7,
key: 'unversioned',
version_year: 'unversioned',
content_root_id: 16,
content_root_id: 10,
name: 'Hello World',
path: '/s/hello-world',
type: 'Script',
Expand Down Expand Up @@ -312,7 +316,7 @@ export const courseOfferings = {
id: 8,
key: 'unversioned',
version_year: 'unversioned',
content_root_id: 17,
content_root_id: 11,
name: 'Poem Art',
path: '/s/poem-art',
type: 'Script',
Expand All @@ -337,12 +341,13 @@ export const courseOfferings = {
display_name: 'Artist',
category: 'hoc',
is_featured: false,
participant_audience: 'student',
course_versions: {
9: {
id: 9,
key: 'unversioned',
version_year: 'unversioned',
content_root_id: 18,
content_root_id: 12,
name: 'Artist',
path: '/s/artist',
type: 'Script',
Expand All @@ -361,5 +366,97 @@ export const courseOfferings = {
}
}
}
},
8: {
id: 8,
display_name: 'Self Paced PL CSP',
category: 'self_paced_pl',
is_featured: false,
participant_audience: 'teacher',
course_versions: {
10: {
id: 10,
key: '2021',
version_year: '2021',
content_root_id: 53,
name: 'Self Paced PL CSP 2021',
path: '/courses/self-paced-pl-csp-2021',
type: 'UnitGroup',
is_stable: true,
is_recommended: true,
locales: [],
units: {
13: {
id: 13,
name: 'Unit 1',
path: '/s/self-paced-pl-csp1-2021',
lesson_extras_available: false,
text_to_speech_enabled: false,
position: 1
},
14: {
id: 14,
name: 'Unit 2',
path: '/s/self-paced-pl-csp2-2021',
lesson_extras_available: false,
text_to_speech_enabled: false,
position: 2
}
}
}
}
},
9: {
id: 9,
display_name: 'Virtual PL CSP',
category: 'virtual_pl',
is_featured: false,
participant_audience: 'teacher',
course_versions: {
11: {
id: 11,
key: '2020',
version_year: '2020',
content_root_id: 15,
name: 'Virtual PL CSP 2020',
path: '/s/vpl-csp-2020',
type: 'Script',
is_stable: true,
is_recommended: true,
locales: [],
units: {
15: {
id: 15,
name: 'Virtual PL CSP 2020',
path: '/s/vpl-csp-2020',
lesson_extras_available: false,
text_to_speech_enabled: false,
position: null
}
}
},
12: {
id: 12,
key: '2021',
version_year: '2021',
content_root_id: 16,
name: 'Virtual PL CSP 2021',
path: '/s/vpl-csp-2021',
type: 'Script',
is_stable: true,
is_recommended: true,
locales: [],
units: {
16: {
id: 16,
name: 'Virtual PL CSP 2021',
path: '/s/vpl-csp-2021',
lesson_extras_available: false,
text_to_speech_enabled: false,
position: null
}
}
}
}
}
};
27 changes: 25 additions & 2 deletions apps/src/templates/teacherDashboard/teacherSectionsRedux.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const USER_EDITABLE_SECTION_PROPS = [
'lessonExtras',
'pairingAllowed',
'ttsAutoplayEnabled',
'participantType',
'courseId',
'scriptId',
'courseOfferingId',
Expand Down Expand Up @@ -48,6 +49,8 @@ const importUrlByProvider = {
// Action keys
//
const SET_COURSE_OFFERINGS = 'teacherDashboard/SET_COURSE_OFFERINGS';
const SET_AVAILABLE_PARTICIPANT_TYPES =
'teacherDashboard/SET_AVAILABLE_PARTICIPANT_TYPES';
const SET_VALID_ASSIGNMENTS = 'teacherDashboard/SET_VALID_ASSIGNMENTS';
const SET_STUDENT_SECTION = 'teacherDashboard/SET_STUDENT_SECTION';
const SET_PAGE_TYPE = 'teacherDashboard/SET_PAGE_TYPE';
Expand Down Expand Up @@ -128,6 +131,10 @@ export const setCourseOfferings = courseOfferings => ({
type: SET_COURSE_OFFERINGS,
courseOfferings
});
export const setAvailableParticipantTypes = availableParticipantTypes => ({
type: SET_AVAILABLE_PARTICIPANT_TYPES,
availableParticipantTypes
});
export const setStudentsForCurrentSection = (sectionId, studentInfo) => ({
type: SET_STUDENT_SECTION,
sectionId: sectionId,
Expand Down Expand Up @@ -388,7 +395,8 @@ export const asyncLoadSectionData = id => dispatch => {
'/dashboardapi/sections',
`/dashboardapi/courses`,
'/dashboardapi/sections/valid_scripts',
'/dashboardapi/sections/valid_course_offerings'
'/dashboardapi/sections/valid_course_offerings',
'/dashboardapi/sections/available_participant_types'
];
if (id) {
apis.push('/dashboardapi/sections/' + id + '/students');
Expand All @@ -401,10 +409,16 @@ export const asyncLoadSectionData = id => dispatch => {
validCourses,
validScripts,
validCourseOfferings,
availableParticipantTypes,
students
]) => {
dispatch(setValidAssignments(validCourses, validScripts));
dispatch(setCourseOfferings(validCourseOfferings));
dispatch(
setAvailableParticipantTypes(
availableParticipantTypes.availableParticipantTypes
)
);
dispatch(setSections(sections));
if (id) {
dispatch(setStudentsForCurrentSection(id, students));
Expand Down Expand Up @@ -542,6 +556,8 @@ const initialState = {
// with options like "CSD", "Course A", or "Frozen". See the
// assignmentCourseOfferingShape PropType.
courseOfferings: {},
// The participant types the user can create sections for
availableParticipantTypes: [],
// Mapping from sectionId to section object
sections: {},
// List of students in section currently being edited (see studentShape PropType)
Expand Down Expand Up @@ -569,13 +585,13 @@ const initialState = {
// DCDO Flag - show/hide Lock Section field
showLockSectionField: null
};

/**
* Generate shape for new section
* @param id
* @param loginType
* @returns {sectionShape}
*/

function newSectionData(id, loginType) {
return {
id: id,
Expand Down Expand Up @@ -716,6 +732,13 @@ export default function teacherSections(state = initialState, action) {
};
}

if (action.type === SET_AVAILABLE_PARTICIPANT_TYPES) {
return {
...state,
availableParticipantTypes: action.availableParticipantTypes
};
}

if (action.type === SET_STUDENT_SECTION) {
const students = action.students || [];
const selectedStudents = students.map(student =>
Expand Down

0 comments on commit 0dcedf6

Please sign in to comment.