From e3b32fb99499d68a2487edf91571c6b74021d3ca Mon Sep 17 00:00:00 2001 From: Edgar Duran-Perez Date: Wed, 13 Jan 2021 15:55:25 -0800 Subject: [PATCH 01/28] confirmation modal when conversion is required --- app/course/courseApp.js | 5 +++- .../convertSectionsModal.css | 23 +++++++++++++++ .../convertSectionsModal.html | 25 +++++++++++++++++ .../convertSectionsModal.js | 28 +++++++++++++++++++ .../directives/courseDetails/courseDetails.js | 19 ++++++++++++- app/course/services/courseActionCreators.js | 12 ++++++-- app/course/services/courseStateService.js | 8 ++++++ app/course/templates/CourseCtrl.html | 8 +++++- 8 files changed, 123 insertions(+), 5 deletions(-) create mode 100644 app/course/directives/convertSectionsModal/convertSectionsModal.css create mode 100644 app/course/directives/convertSectionsModal/convertSectionsModal.html create mode 100644 app/course/directives/convertSectionsModal/convertSectionsModal.js diff --git a/app/course/courseApp.js b/app/course/courseApp.js index e785a5fb1..e7f462231 100644 --- a/app/course/courseApp.js +++ b/app/course/courseApp.js @@ -24,6 +24,7 @@ import censusChart from './directives/censusChart.js'; import courseTable from './directives/courseTable.js'; import activeFilters from './directives/activeFilters/activeFilters.js'; import moveCourseModal from './directives/moveCourseModal/moveCourseModal.js'; +import convertSectionsModal from './directives/convertSectionsModal/convertSectionsModal.js' // Dependencies var dependencies = [ @@ -88,6 +89,7 @@ const courseApp = angular.module("courseApp", dependencies) // eslint-disable-li .directive('censusChart', censusChart) .directive('courseTable', courseTable) .directive('activeFilters', activeFilters) +.directive('convertSectionsModal', convertSectionsModal) .constant('ActionTypes', { INIT_STATE: "INIT_STATE", NEW_COURSE: "NEW_COURSE", @@ -124,7 +126,8 @@ const courseApp = angular.module("courseApp", dependencies) // eslint-disable-li CLOSE_COURSE_DELETION_MODAL: "CLOSE_COURSE_DELETION_MODAL", TOGGLE_MOVE_COURSE_MODAL: "TOGGLE_MOVE_COURSE_MODAL", DELETE_MULTIPLE_COURSES: "DELETE_MULTIPLE_COURSES", - MASS_ASSIGN_TAGS: "MASS_ASSIGN_TAGS" + MASS_ASSIGN_TAGS: "MASS_ASSIGN_TAGS", + TOGGLE_CONVERT_SECTIONS_MODAL: "TOGGLE_CONVERT_SECTIONS_MODAL" }); export default courseApp; diff --git a/app/course/directives/convertSectionsModal/convertSectionsModal.css b/app/course/directives/convertSectionsModal/convertSectionsModal.css new file mode 100644 index 000000000..6244ebd32 --- /dev/null +++ b/app/course/directives/convertSectionsModal/convertSectionsModal.css @@ -0,0 +1,23 @@ +.convert-sections-modal .convert-sections-modal-footer { + padding: 10px; + display: flex; + justify-content: flex-end; + padding-bottom: 15px; + padding-top: 15px; + background-color: rgb(248, 248, 248); +} + +.convert-sections-modal .convert-sections-warning { + padding: 20px; +} + +.convert-sections-modal .sub-detail { + font-weight: bold; + font-size: 14px; + padding-top: 15px; +} + +.convert-sections-modal .btn-default { + background-color: white; + margin-right: 10px; +} diff --git a/app/course/directives/convertSectionsModal/convertSectionsModal.html b/app/course/directives/convertSectionsModal/convertSectionsModal.html new file mode 100644 index 000000000..dfd43e724 --- /dev/null +++ b/app/course/directives/convertSectionsModal/convertSectionsModal.html @@ -0,0 +1,25 @@ +
+
+
+
+ Are you sure you want to update the sequence pattern to {{sequencePattern}}? +
+
+ This will also convert the sections that belong to this courses. +
+
+ + +
+
diff --git a/app/course/directives/convertSectionsModal/convertSectionsModal.js b/app/course/directives/convertSectionsModal/convertSectionsModal.js new file mode 100644 index 000000000..ba27a4603 --- /dev/null +++ b/app/course/directives/convertSectionsModal/convertSectionsModal.js @@ -0,0 +1,28 @@ +import './convertSectionsModal.css'; + +let convertSectionsModal = function ($rootScope, CourseActionCreators) { + return { + restrict: 'E', + template: require('./convertSectionsModal.html'), + replace: true, + scope: { + selectedEntity: '<', + sequencePattern: '<', + isVisible: '=' + }, + link: function (scope) { + + scope.updateCourse = function () { + scope.selectedEntity.sequencePattern = scope.sequencePattern + CourseActionCreators.updateCourse(scope.selectedEntity); + scope.isVisible = false; + }; + + scope.close = function() { + scope.isVisible = false; + }; + } // end link + }; +}; + +export default convertSectionsModal; diff --git a/app/course/directives/courseDetails/courseDetails.js b/app/course/directives/courseDetails/courseDetails.js index 3938e80d1..3968e3d6e 100644 --- a/app/course/directives/courseDetails/courseDetails.js +++ b/app/course/directives/courseDetails/courseDetails.js @@ -69,9 +69,26 @@ let courseDetails = function (CourseActionCreators, SectionService) { scope.originalSequencePattern = sequencePattern.toUpperCase(); scope.view.selectedEntity.sequencePattern = scope.view.selectedEntity.sequencePattern.toUpperCase(); - CourseActionCreators.updateCourse(scope.view.selectedEntity); + + if(scope.requiresConversion(scope.originalSequencePattern, scope.view.state.courses.list[scope.view.selectedEntity.id].sequencePattern)){ + CourseActionCreators.toggleConvertSectionsModal(sequencePattern.toUpperCase()); + } else{ + CourseActionCreators.updateCourse(scope.view.selectedEntity); + } }; + scope.requiresConversion = function(oldSequencePattern, newSequencePattern) { + if(oldSequencePattern && newSequencePattern){ + if(oldSequencePattern.length != newSequencePattern.length){ + return true; + } else { + return false; + } + } else { + return false; + } + } + scope.isSequencePatternUnique = function (sequencePattern) { let courseDescription = scope.view.selectedEntity.subjectCode + "-" + scope.view.selectedEntity.courseNumber + "-" + sequencePattern; let isUnique = true; diff --git a/app/course/services/courseActionCreators.js b/app/course/services/courseActionCreators.js index 44f9baf87..8d0330c92 100644 --- a/app/course/services/courseActionCreators.js +++ b/app/course/services/courseActionCreators.js @@ -197,7 +197,7 @@ class CourseActionCreators { var self = this; CourseService.deleteMultipleCourses(courseIds, workgroupId, year).then(function () { window.ipa_analyze_event('courses', 'multiple courses deleted'); - + $rootScope.$emit('toast', { message: "Deleted courses.", type: "SUCCESS" }); var action = { type: ActionTypes.DELETE_MULTIPLE_COURSES, @@ -585,6 +585,14 @@ class CourseActionCreators { } }); }, + toggleConvertSectionsModal: function(sequencePattern) { + CourseStateService.reduce({ + type: ActionTypes.TOGGLE_CONVERT_SECTIONS_MODAL, + payload: { + sequencePattern: sequencePattern + } + }); + }, _generateAttentionFlags: function(payload) { var sectionGroups = []; var sections = []; @@ -596,7 +604,7 @@ class CourseActionCreators { } else { sectionGroups = payload.sectionGroups; sections = payload.sections; - } + } for (var i = 0; i < sectionGroups.length; i++) { var sectionGroup = sectionGroups[i]; diff --git a/app/course/services/courseStateService.js b/app/course/services/courseStateService.js index 9d79f77e8..79c2e3ed2 100644 --- a/app/course/services/courseStateService.js +++ b/app/course/services/courseStateService.js @@ -446,6 +446,10 @@ class CourseStateService { searchingCourseToImport: false, selectedCourseRowIds: [], isCourseDeleteModalOpen: false, + convertSectionsModal: { + isVisible: false, + newSequence: null + }, moveCourseModal: { show: false, selectedSectionGroup: null, @@ -566,6 +570,10 @@ class CourseStateService { case ActionTypes.CLOSE_COURSE_DELETION_MODAL: uiState.isCourseDeleteModalOpen = false; return uiState; + case ActionTypes.TOGGLE_CONVERT_SECTIONS_MODAL: + uiState.convertSectionsModal.isVisible = !uiState.convertSectionsModal.isVisible; + uiState.convertSectionsModal.sequencePattern = action.payload.sequencePattern; + return uiState; case ActionTypes.TOGGLE_MOVE_COURSE_MODAL: uiState.moveCourseModal.show = !uiState.moveCourseModal.show; uiState.moveCourseModal.selectedSectionGroup = action.payload.selectedSectionGroup; diff --git a/app/course/templates/CourseCtrl.html b/app/course/templates/CourseCtrl.html index f3d5fa8cd..07ba400e5 100644 --- a/app/course/templates/CourseCtrl.html +++ b/app/course/templates/CourseCtrl.html @@ -11,6 +11,12 @@ + + + + - From a622a6b0a1303ba0a6eb4162f27ec60c2ece969f Mon Sep 17 00:00:00 2001 From: Edgar Duran-Perez Date: Wed, 13 Jan 2021 16:42:30 -0800 Subject: [PATCH 02/28] always fetch sections --- app/course/controllers/CourseCtrl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/course/controllers/CourseCtrl.js b/app/course/controllers/CourseCtrl.js index 2058c600e..4b5657062 100644 --- a/app/course/controllers/CourseCtrl.js +++ b/app/course/controllers/CourseCtrl.js @@ -242,7 +242,7 @@ class CourseCtrl { _self.$scope.view.selectedEntity = _self.$scope.view.state.sectionGroups.selectedSectionGroup || _self.$scope.view.state.sectionGroups.newSectionGroup; // Initialize sectionGroup sections if not done already - if (_self.$scope.view.selectedEntity && _self.$scope.view.selectedEntity.id && _self.$scope.view.selectedEntity.sectionIds === undefined && _self.$scope.view.state.uiState.sectionsFetchInProgress == false) { + if (_self.$scope.view.selectedEntity && _self.$scope.view.selectedEntity.id && _self.$scope.view.state.uiState.sectionsFetchInProgress == false) { _self.courseActionCreators.getSectionsBySectionGroup(_self.$scope.view.selectedEntity); } From 246ab751d5f735a88ddad2080ea60803abb9cb23 Mon Sep 17 00:00:00 2001 From: Edgar Duran-Perez Date: Thu, 14 Jan 2021 08:38:15 -0800 Subject: [PATCH 03/28] dont compare against self for uniqueness --- app/course/directives/courseDetails/courseDetails.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/course/directives/courseDetails/courseDetails.js b/app/course/directives/courseDetails/courseDetails.js index 3968e3d6e..98c9cf54b 100644 --- a/app/course/directives/courseDetails/courseDetails.js +++ b/app/course/directives/courseDetails/courseDetails.js @@ -59,7 +59,7 @@ let courseDetails = function (CourseActionCreators, SectionService) { return; } - if (scope.isSequencePatternUnique(sequencePattern) == false) { + if (scope.isSequencePatternUnique(sequencePattern, scope.view.selectedEntity.id) == false) { scope.courseDetails.sequencePatternTooltipMessage = "Sequence pattern already in use"; return; } @@ -89,7 +89,7 @@ let courseDetails = function (CourseActionCreators, SectionService) { } } - scope.isSequencePatternUnique = function (sequencePattern) { + scope.isSequencePatternUnique = function (sequencePattern, currentCourseId) { let courseDescription = scope.view.selectedEntity.subjectCode + "-" + scope.view.selectedEntity.courseNumber + "-" + sequencePattern; let isUnique = true; @@ -97,7 +97,7 @@ let courseDetails = function (CourseActionCreators, SectionService) { let course = scope.view.state.courses.list[courseId]; let slotCourseDescription = course.subjectCode + "-" + course.courseNumber + "-" + course.sequencePattern; - if (courseDescription == slotCourseDescription) { + if (courseDescription == slotCourseDescription && courseId !== currentCourseId) { isUnique = false; } }); From 1510d9cb8dd6c76ba36c0a9c76ee0fab7ac75718 Mon Sep 17 00:00:00 2001 From: Edgar Duran-Perez Date: Thu, 14 Jan 2021 08:59:37 -0800 Subject: [PATCH 04/28] reset original sequence pattern --- app/course/directives/courseDetails/courseDetails.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/course/directives/courseDetails/courseDetails.js b/app/course/directives/courseDetails/courseDetails.js index 98c9cf54b..7ed0e40ed 100644 --- a/app/course/directives/courseDetails/courseDetails.js +++ b/app/course/directives/courseDetails/courseDetails.js @@ -72,6 +72,7 @@ let courseDetails = function (CourseActionCreators, SectionService) { if(scope.requiresConversion(scope.originalSequencePattern, scope.view.state.courses.list[scope.view.selectedEntity.id].sequencePattern)){ CourseActionCreators.toggleConvertSectionsModal(sequencePattern.toUpperCase()); + scope.originalSequencePattern = null; } else{ CourseActionCreators.updateCourse(scope.view.selectedEntity); } From 15d525d7f3bf4ae2fcbd81c578b4f190eb3626d2 Mon Sep 17 00:00:00 2001 From: Edgar Duran-Perez Date: Thu, 14 Jan 2021 09:38:13 -0800 Subject: [PATCH 05/28] show before and after sequence pattern in confirmation modal --- .../directives/convertSectionsModal/convertSectionsModal.html | 2 +- app/course/directives/courseDetails/courseDetails.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/course/directives/convertSectionsModal/convertSectionsModal.html b/app/course/directives/convertSectionsModal/convertSectionsModal.html index dfd43e724..9034691b8 100644 --- a/app/course/directives/convertSectionsModal/convertSectionsModal.html +++ b/app/course/directives/convertSectionsModal/convertSectionsModal.html @@ -2,7 +2,7 @@
- Are you sure you want to update the sequence pattern to {{sequencePattern}}? + Are you sure you want to update the sequence pattern from {{selectedEntity.sequencePattern}} to {{sequencePattern}}?
This will also convert the sections that belong to this courses. diff --git a/app/course/directives/courseDetails/courseDetails.js b/app/course/directives/courseDetails/courseDetails.js index 7ed0e40ed..56aa44fe9 100644 --- a/app/course/directives/courseDetails/courseDetails.js +++ b/app/course/directives/courseDetails/courseDetails.js @@ -72,7 +72,7 @@ let courseDetails = function (CourseActionCreators, SectionService) { if(scope.requiresConversion(scope.originalSequencePattern, scope.view.state.courses.list[scope.view.selectedEntity.id].sequencePattern)){ CourseActionCreators.toggleConvertSectionsModal(sequencePattern.toUpperCase()); - scope.originalSequencePattern = null; + scope.originalSequencePattern = scope.view.state.courses.list[scope.view.selectedEntity.id].sequencePattern; } else{ CourseActionCreators.updateCourse(scope.view.selectedEntity); } From 6ed6bacb1f529f26fe80c70883f5d2c5442c560a Mon Sep 17 00:00:00 2001 From: Edgar Duran-Perez Date: Thu, 14 Jan 2021 09:48:02 -0800 Subject: [PATCH 06/28] fix padding --- app/course/directives/courseDetails/courseDetails.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/course/directives/courseDetails/courseDetails.html b/app/course/directives/courseDetails/courseDetails.html index e4f284b79..4d9436397 100644 --- a/app/course/directives/courseDetails/courseDetails.html +++ b/app/course/directives/courseDetails/courseDetails.html @@ -46,7 +46,7 @@

Sequence Pattern
-
From 7141ab39bc634cfaad44d1e7cc2b1ab49863a17c Mon Sep 17 00:00:00 2001 From: Edgar Duran-Perez Date: Thu, 14 Jan 2021 11:10:32 -0800 Subject: [PATCH 07/28] example text --- .../convertSectionsModal.css | 8 ++++ .../convertSectionsModal.html | 44 ++++++++++++++++++- 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/app/course/directives/convertSectionsModal/convertSectionsModal.css b/app/course/directives/convertSectionsModal/convertSectionsModal.css index 6244ebd32..783e162a8 100644 --- a/app/course/directives/convertSectionsModal/convertSectionsModal.css +++ b/app/course/directives/convertSectionsModal/convertSectionsModal.css @@ -21,3 +21,11 @@ background-color: white; margin-right: 10px; } + +.convertion-details { + display: flex; +} + +.conversion-details-example { + flex: 50%; +} diff --git a/app/course/directives/convertSectionsModal/convertSectionsModal.html b/app/course/directives/convertSectionsModal/convertSectionsModal.html index 9034691b8..16d2a3166 100644 --- a/app/course/directives/convertSectionsModal/convertSectionsModal.html +++ b/app/course/directives/convertSectionsModal/convertSectionsModal.html @@ -5,7 +5,49 @@ Are you sure you want to update the sequence pattern from {{selectedEntity.sequencePattern}} to {{sequencePattern}}?
- This will also convert the sections that belong to this courses. + This will also convert the sections that belong to this course {{selectedEntity.sequencePattern.length > 1 ? 'from lectures to discussions' : 'from discussions to lectures'}} +

For Example:

+
+
+ Before

+ XYZ 10 - 001 +
  • + Section 001 Seats 100 +
  • +
    +
    + After

    + XYZ 10 - A +
  • + Section A01 Seats 100 +
  • +
    +
    +
    +
    + Before

    + XYZ 10 - A +
  • + Section A01 Seats 25 +
  • +
  • + Section A02 Seats 25 +
  • +
  • + Section A03 Seats 25 +
  • +
  • + Section A04 Seats 25 +
  • +
    +
    + After

    + XYZ 10 - 001 +
  • + Section 001 Seats 100 +
  • +
    +
    From ebb146dbf975501520dfe1f1787215f1c4e817d0 Mon Sep 17 00:00:00 2001 From: Edgar Duran-Perez Date: Thu, 14 Jan 2021 12:00:04 -0800 Subject: [PATCH 08/28] compare with state instead of local scope var to check for change --- app/course/directives/courseDetails/courseDetails.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/course/directives/courseDetails/courseDetails.js b/app/course/directives/courseDetails/courseDetails.js index 56aa44fe9..c31142d20 100644 --- a/app/course/directives/courseDetails/courseDetails.js +++ b/app/course/directives/courseDetails/courseDetails.js @@ -49,7 +49,7 @@ let courseDetails = function (CourseActionCreators, SectionService) { let sequencePattern = scope.view.selectedEntity.sequencePattern; // Do nothing if sequencePattern is unchanged - if (sequencePattern == scope.originalSequencePattern) { + if (sequencePattern == scope.view.state.courses.list[scope.view.selectedEntity.id].sequencePattern) { scope.courseDetails.sequencePatternTooltipMessage = null; return true; } @@ -72,7 +72,6 @@ let courseDetails = function (CourseActionCreators, SectionService) { if(scope.requiresConversion(scope.originalSequencePattern, scope.view.state.courses.list[scope.view.selectedEntity.id].sequencePattern)){ CourseActionCreators.toggleConvertSectionsModal(sequencePattern.toUpperCase()); - scope.originalSequencePattern = scope.view.state.courses.list[scope.view.selectedEntity.id].sequencePattern; } else{ CourseActionCreators.updateCourse(scope.view.selectedEntity); } From 5d1548fe5a2e74a4a513255e18d1275efa7944da Mon Sep 17 00:00:00 2001 From: Edgar Duran-Perez Date: Fri, 15 Jan 2021 08:49:24 -0800 Subject: [PATCH 09/28] linting --- app/course/courseApp.js | 2 +- .../convertSectionsModal/convertSectionsModal.js | 2 +- app/course/directives/courseDetails/courseDetails.js | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/course/courseApp.js b/app/course/courseApp.js index e7f462231..36466bc60 100644 --- a/app/course/courseApp.js +++ b/app/course/courseApp.js @@ -24,7 +24,7 @@ import censusChart from './directives/censusChart.js'; import courseTable from './directives/courseTable.js'; import activeFilters from './directives/activeFilters/activeFilters.js'; import moveCourseModal from './directives/moveCourseModal/moveCourseModal.js'; -import convertSectionsModal from './directives/convertSectionsModal/convertSectionsModal.js' +import convertSectionsModal from './directives/convertSectionsModal/convertSectionsModal.js'; // Dependencies var dependencies = [ diff --git a/app/course/directives/convertSectionsModal/convertSectionsModal.js b/app/course/directives/convertSectionsModal/convertSectionsModal.js index ba27a4603..cfe9bc6a9 100644 --- a/app/course/directives/convertSectionsModal/convertSectionsModal.js +++ b/app/course/directives/convertSectionsModal/convertSectionsModal.js @@ -13,7 +13,7 @@ let convertSectionsModal = function ($rootScope, CourseActionCreators) { link: function (scope) { scope.updateCourse = function () { - scope.selectedEntity.sequencePattern = scope.sequencePattern + scope.selectedEntity.sequencePattern = scope.sequencePattern; CourseActionCreators.updateCourse(scope.selectedEntity); scope.isVisible = false; }; diff --git a/app/course/directives/courseDetails/courseDetails.js b/app/course/directives/courseDetails/courseDetails.js index c31142d20..77c701c93 100644 --- a/app/course/directives/courseDetails/courseDetails.js +++ b/app/course/directives/courseDetails/courseDetails.js @@ -70,16 +70,16 @@ let courseDetails = function (CourseActionCreators, SectionService) { scope.originalSequencePattern = sequencePattern.toUpperCase(); scope.view.selectedEntity.sequencePattern = scope.view.selectedEntity.sequencePattern.toUpperCase(); - if(scope.requiresConversion(scope.originalSequencePattern, scope.view.state.courses.list[scope.view.selectedEntity.id].sequencePattern)){ + if (scope.requiresConversion(scope.originalSequencePattern, scope.view.state.courses.list[scope.view.selectedEntity.id].sequencePattern)){ CourseActionCreators.toggleConvertSectionsModal(sequencePattern.toUpperCase()); - } else{ + } else { CourseActionCreators.updateCourse(scope.view.selectedEntity); } }; scope.requiresConversion = function(oldSequencePattern, newSequencePattern) { - if(oldSequencePattern && newSequencePattern){ - if(oldSequencePattern.length != newSequencePattern.length){ + if (oldSequencePattern && newSequencePattern){ + if (oldSequencePattern.length != newSequencePattern.length) { return true; } else { return false; @@ -87,7 +87,7 @@ let courseDetails = function (CourseActionCreators, SectionService) { } else { return false; } - } + }; scope.isSequencePatternUnique = function (sequencePattern, currentCourseId) { let courseDescription = scope.view.selectedEntity.subjectCode + "-" + scope.view.selectedEntity.courseNumber + "-" + sequencePattern; From 04b640fd68822927318768b9a419812ae1fa2249 Mon Sep 17 00:00:00 2001 From: Edgar Duran-Perez Date: Tue, 19 Jan 2021 09:31:12 -0800 Subject: [PATCH 10/28] change seat display for example --- .../convertSectionsModal/convertSectionsModal.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/course/directives/convertSectionsModal/convertSectionsModal.html b/app/course/directives/convertSectionsModal/convertSectionsModal.html index 16d2a3166..b9a9e74f6 100644 --- a/app/course/directives/convertSectionsModal/convertSectionsModal.html +++ b/app/course/directives/convertSectionsModal/convertSectionsModal.html @@ -12,14 +12,14 @@ Before

    XYZ 10 - 001
  • - Section 001 Seats 100 + Section 001: 100 Seats
  • After

    XYZ 10 - A
  • - Section A01 Seats 100 + Section A01: 100 Seats
  • @@ -28,16 +28,16 @@ Before

    XYZ 10 - A
  • - Section A01 Seats 25 + Section A01: 25 Seats
  • - Section A02 Seats 25 + Section A02: 25 Seats
  • - Section A03 Seats 25 + Section A03: 25 Seats
  • - Section A04 Seats 25 + Section A04: 25 Seats
  • From 0a7373a5a95e59bd39512b041cf34445cc8e29a2 Mon Sep 17 00:00:00 2001 From: Edgar Duran-Perez Date: Tue, 19 Jan 2021 14:28:02 -0800 Subject: [PATCH 11/28] clear section list on course update --- app/course/controllers/CourseCtrl.js | 2 +- app/course/services/courseStateService.js | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/course/controllers/CourseCtrl.js b/app/course/controllers/CourseCtrl.js index 4b5657062..2058c600e 100644 --- a/app/course/controllers/CourseCtrl.js +++ b/app/course/controllers/CourseCtrl.js @@ -242,7 +242,7 @@ class CourseCtrl { _self.$scope.view.selectedEntity = _self.$scope.view.state.sectionGroups.selectedSectionGroup || _self.$scope.view.state.sectionGroups.newSectionGroup; // Initialize sectionGroup sections if not done already - if (_self.$scope.view.selectedEntity && _self.$scope.view.selectedEntity.id && _self.$scope.view.state.uiState.sectionsFetchInProgress == false) { + if (_self.$scope.view.selectedEntity && _self.$scope.view.selectedEntity.id && _self.$scope.view.selectedEntity.sectionIds === undefined && _self.$scope.view.state.uiState.sectionsFetchInProgress == false) { _self.courseActionCreators.getSectionsBySectionGroup(_self.$scope.view.selectedEntity); } diff --git a/app/course/services/courseStateService.js b/app/course/services/courseStateService.js index 79c2e3ed2..507dfa15c 100644 --- a/app/course/services/courseStateService.js +++ b/app/course/services/courseStateService.js @@ -314,6 +314,13 @@ class CourseStateService { case ActionTypes.END_IMPORT_MODE: sectionGroups.importList = null; return sectionGroups; + case ActionTypes.UPDATE_COURSE: + sectionGroups.ids.forEach(function (sectionId) { + if(sectionGroups.list[sectionId].sectionIds){ + delete sectionGroups.list[sectionId].sectionIds; + } + }) + return sectionGroups; default: return sectionGroups; } From 9088e7b511e150b99fb5b6c9e847e45064bb5655 Mon Sep 17 00:00:00 2001 From: Edgar Duran-Perez Date: Tue, 19 Jan 2021 15:07:28 -0800 Subject: [PATCH 12/28] update sections array on FETCH_SECTIONS --- app/course/services/courseStateService.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/course/services/courseStateService.js b/app/course/services/courseStateService.js index 507dfa15c..40d0df5cc 100644 --- a/app/course/services/courseStateService.js +++ b/app/course/services/courseStateService.js @@ -275,6 +275,7 @@ class CourseStateService { return 0; }) .map(function (section) { return section.id; }); + sectionGroups.list[action.payload.sectionGroup.id].sections = action.payload.sections; return sectionGroups; case ActionTypes.CREATE_SECTION: sectionGroups.selectedSectionGroup = sectionGroups.list[action.payload.section.sectionGroupId]; From 709e8f8eb528993f3c9fe6e2fa2f00870bef4a55 Mon Sep 17 00:00:00 2001 From: Edgar Duran-Perez Date: Thu, 21 Jan 2021 09:54:15 -0800 Subject: [PATCH 13/28] create new course --- .../convertSectionsModal.html | 17 ++++++++++++----- .../convertSectionsModal.js | 12 +++++++----- .../sectionGroupDetails.html | 7 +++++++ .../sectionGroupDetails/sectionGroupDetails.js | 4 ++++ 4 files changed, 30 insertions(+), 10 deletions(-) diff --git a/app/course/directives/convertSectionsModal/convertSectionsModal.html b/app/course/directives/convertSectionsModal/convertSectionsModal.html index b9a9e74f6..804cdc8ba 100644 --- a/app/course/directives/convertSectionsModal/convertSectionsModal.html +++ b/app/course/directives/convertSectionsModal/convertSectionsModal.html @@ -1,11 +1,18 @@
    +
    + Sequence Pattern +
    +
    + + +
    - Are you sure you want to update the sequence pattern from {{selectedEntity.sequencePattern}} to {{sequencePattern}}? -
    -
    - This will also convert the sections that belong to this course {{selectedEntity.sequencePattern.length > 1 ? 'from lectures to discussions' : 'from discussions to lectures'}} + This will also convert the sections that belong to this course offering {{selectedEntity.sequencePattern.length > 1 ? 'from lectures to discussions' : 'from discussions to lectures'}}

    For Example:

    @@ -57,7 +64,7 @@ class="btn btn-default modal-button"> Cancel - +
    diff --git a/app/course/directives/convertSectionsModal/convertSectionsModal.js b/app/course/directives/convertSectionsModal/convertSectionsModal.js index e3d393ebf..d188c4acc 100644 --- a/app/course/directives/convertSectionsModal/convertSectionsModal.js +++ b/app/course/directives/convertSectionsModal/convertSectionsModal.js @@ -9,7 +9,8 @@ let convertSectionsModal = function (CourseActionCreators) { workgroupId: '<', year: '<', selectedEntity: '<', - isVisible: '=' + isVisible: '=', + state: '=' }, link: function (scope) { scope.sequencePattern = ''; @@ -23,6 +24,15 @@ let convertSectionsModal = function (CourseActionCreators) { scope.close = function() { scope.isVisible = false; }; + + scope.isSeries = function () { + if(scope.selectedEntity){ + let selectedEntity = scope.selectedEntity; + let course = scope.state.courses.list[selectedEntity.courseId]; + return course.isSeries(); + } + return false; + }; } // end link }; }; diff --git a/app/course/directives/sectionGroupDetails/sectionGroupDetails.css b/app/course/directives/sectionGroupDetails/sectionGroupDetails.css new file mode 100644 index 000000000..6dbf4f9e2 --- /dev/null +++ b/app/course/directives/sectionGroupDetails/sectionGroupDetails.css @@ -0,0 +1,3 @@ +.section-group-details__convert-offering-container { + margin-bottom: 20px +} diff --git a/app/course/directives/sectionGroupDetails/sectionGroupDetails.html b/app/course/directives/sectionGroupDetails/sectionGroupDetails.html index 789f76464..dbe24a895 100644 --- a/app/course/directives/sectionGroupDetails/sectionGroupDetails.html +++ b/app/course/directives/sectionGroupDetails/sectionGroupDetails.html @@ -111,12 +111,14 @@

    overflow-auto="true" > - +
    + +


    After conversion teaching assignments and the Live Data budget scenario will be updated to reflect the change.
    - Other budget scenarios will be updated if they do not have a conflicting offering. + All non-live data budget scenarios will be updated unless they have a conflicting offering. +
    Budget requests will not be updated.

    Additionally, sections that belong to this course offering will be converted from {{isSeries() ? 'discussions to lectures' : 'lectures to discussions'}} diff --git a/app/course/directives/convertSectionsModal/convertSectionsModal.js b/app/course/directives/convertSectionsModal/convertSectionsModal.js index a072e70cf..0297db1dd 100644 --- a/app/course/directives/convertSectionsModal/convertSectionsModal.js +++ b/app/course/directives/convertSectionsModal/convertSectionsModal.js @@ -71,7 +71,7 @@ let convertSectionsModal = function (CourseActionCreators) { if (scope.selectedEntity && scope.selectedEntity.sequencePattern){ var sectionGroup = scope.selectedEntity; var course = course = scope.state.courses.list[sectionGroup.courseId]; - var courseDescription = course.subjectCode + "-" + course.courseNumber + "-" + sectionGroup.sequencePattern; + var courseDescription = course.subjectCode + "-" + course.courseNumber + "-" + sectionGroup.sequencePattern.toUpperCase(); isUnique = true; scope.selectedEntity.sequencePatternTooltipMessage = null; @@ -93,6 +93,12 @@ let convertSectionsModal = function (CourseActionCreators) { return isUnique; }; + + scope.updateSequencePattern = function(){ + if (scope.selectedEntity.sequencePattern){ + scope.selectedEntity.sequencePattern = scope.selectedEntity.sequencePattern.toUpperCase(); + } + }; } // end link }; }; diff --git a/app/course/directives/courseDetails/courseDetails.html b/app/course/directives/courseDetails/courseDetails.html index e4f284b79..ec9264165 100644 --- a/app/course/directives/courseDetails/courseDetails.html +++ b/app/course/directives/courseDetails/courseDetails.html @@ -53,7 +53,7 @@