From 480d67d0b8ae9d6ceebf1dcb401ac8034b0e9a5e Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Wed, 28 Nov 2018 10:05:58 -0800 Subject: [PATCH 01/35] BudgetView: Add incomingChanges section --- app/budget/BudgetCtrl.html | 181 +++++++++--------- app/budget/budgetApp.js | 2 + .../directives/budgetNav/budgetNav.html | 3 + .../incomingChanges/incomingChanges.css | 0 .../incomingChanges/incomingChanges.html | 92 +++++++++ .../incomingChanges/incomingChanges.js | 19 ++ app/budget/services/budgetReducers.js | 2 +- 7 files changed, 208 insertions(+), 91 deletions(-) create mode 100644 app/budget/directives/incomingChanges/incomingChanges.css create mode 100644 app/budget/directives/incomingChanges/incomingChanges.html create mode 100644 app/budget/directives/incomingChanges/incomingChanges.js diff --git a/app/budget/BudgetCtrl.html b/app/budget/BudgetCtrl.html index d3c45bfb7..401b42885 100644 --- a/app/budget/BudgetCtrl.html +++ b/app/budget/BudgetCtrl.html @@ -3,104 +3,105 @@
- - + + -
- - - - - +
+ + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - + - - + + -
- - - - - - - - - - -
-
+
+ + + + + + + + + + + +
+
diff --git a/app/budget/budgetApp.js b/app/budget/budgetApp.js index 1179c00ec..9bda6ca9d 100644 --- a/app/budget/budgetApp.js +++ b/app/budget/budgetApp.js @@ -19,6 +19,7 @@ import AuthService from './../shared/services/AuthService.js'; import SectionService from './../shared/services/SectionService.js'; // Directives +import incomingChanges from './directives/incomingChanges/incomingChanges.js'; import budgetNav from './directives/budgetNav/budgetNav.js'; import lineItemFilters from './directives/budgetNav/lineItemFilters/lineItemFilters.js'; @@ -103,6 +104,7 @@ const budgetApp = angular.module("budgetApp", dependencies) .directive('addLineItem', addLineItem) .directive('addLineItemComments', addLineItemComments) .directive('courseList', courseList) +.directive('incomingChanges', incomingChanges) .constant('ActionTypes', { INIT_STATE: "INIT_STATE", CREATE_BUDGET_SCENARIO: "CREATE_BUDGET_SCENARIO", diff --git a/app/budget/directives/budgetNav/budgetNav.html b/app/budget/directives/budgetNav/budgetNav.html index 646f6ffe3..05526547f 100644 --- a/app/budget/directives/budgetNav/budgetNav.html +++ b/app/budget/directives/budgetNav/budgetNav.html @@ -15,6 +15,9 @@
Course List
+
+ Incoming Changes +
diff --git a/app/budget/directives/incomingChanges/incomingChanges.css b/app/budget/directives/incomingChanges/incomingChanges.css new file mode 100644 index 000000000..e69de29bb diff --git a/app/budget/directives/incomingChanges/incomingChanges.html b/app/budget/directives/incomingChanges/incomingChanges.html new file mode 100644 index 000000000..bef02b695 --- /dev/null +++ b/app/budget/directives/incomingChanges/incomingChanges.html @@ -0,0 +1,92 @@ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ Course +
+
+
+ Scheduled +
+
+
+ Scenario +
+
+
+ UI +
+
+ + + + + + + + + + + + {{ sectionGroupCost.subjectCode }} + + + {{ sectionGroupCost.courseNumber }} + + {{ sectionGroupCost.title }} + + {{ sectionGroupCost.sequencePattern }} + + + + + + + + + + +
+
+
+ +
diff --git a/app/budget/directives/incomingChanges/incomingChanges.js b/app/budget/directives/incomingChanges/incomingChanges.js new file mode 100644 index 000000000..a96ba671a --- /dev/null +++ b/app/budget/directives/incomingChanges/incomingChanges.js @@ -0,0 +1,19 @@ +import './incomingChanges.css'; + +let incomingChanges = function (BudgetActions) { + return { + restrict: 'E', + template: require('./incomingChanges.html'), + replace: true, + scope: { + termNav: '<' + }, + link: function (scope, element, attrs) { + scope.setActiveTerm = function(activeTermTab) { + BudgetActions.selectTerm(activeTermTab); + }; + } + }; +}; + +export default incomingChanges; diff --git a/app/budget/services/budgetReducers.js b/app/budget/services/budgetReducers.js index 55db7cd68..e555caed0 100644 --- a/app/budget/services/budgetReducers.js +++ b/app/budget/services/budgetReducers.js @@ -710,7 +710,7 @@ class BudgetReducers { }, sectionNav: { activeTab: "Summary", - allTabs: ["Schedule Costs", "Funds", "Summary", "Instructor List", "Course List"] + allTabs: ["Schedule Costs", "Funds", "Summary", "Instructor List", "Course List", "Incoming Changes"] }, termNav: { activeTab: null, From 61d5965dda65d6f20d10af8cb7d637fa786436cb Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Wed, 28 Nov 2018 11:42:42 -0800 Subject: [PATCH 02/35] Add structure to calculate differences between IPA and scenario --- app/budget/BudgetCtrl.html | 7 ++- app/budget/budgetCtrl.js | 2 +- .../incomingChanges/incomingChanges.js | 50 ++++++++++++++++++- app/budget/services/budgetReducers.js | 3 +- 4 files changed, 58 insertions(+), 4 deletions(-) diff --git a/app/budget/BudgetCtrl.html b/app/budget/BudgetCtrl.html index 401b42885..4b67ab7d9 100644 --- a/app/budget/BudgetCtrl.html +++ b/app/budget/BudgetCtrl.html @@ -101,7 +101,12 @@ term-nav="view.state.ui.termNav" selected-budget-scenario="view.state.selectedBudgetScenario"> - + + diff --git a/app/budget/budgetCtrl.js b/app/budget/budgetCtrl.js index 2edc9fa2d..df642d693 100644 --- a/app/budget/budgetCtrl.js +++ b/app/budget/budgetCtrl.js @@ -28,7 +28,7 @@ class BudgetCtrl { this.$rootScope.$on('budgetStateChanged', function (event, data) { _self.$scope.view.state = data; - + console.log(data); // Set the current active budget scenario id if (_self.$scope.view.state.selectedBudgetScenario) { localStorage.setItem('selectedBudgetScenarioId', _self.$scope.view.state.selectedBudgetScenario.id); diff --git a/app/budget/directives/incomingChanges/incomingChanges.js b/app/budget/directives/incomingChanges/incomingChanges.js index a96ba671a..9c444f59d 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.js +++ b/app/budget/directives/incomingChanges/incomingChanges.js @@ -6,12 +6,60 @@ let incomingChanges = function (BudgetActions) { template: require('./incomingChanges.html'), replace: true, scope: { - termNav: '<' + termNav: '<', + sectionGroups: '<', + courses: '<', + sectionGroupCosts: '<' }, link: function (scope, element, attrs) { + // Total of differences, by term scope.setActiveTerm = function(activeTermTab) { BudgetActions.selectTerm(activeTermTab); }; + + scope.calculateChanges = function () { + scope.courses; + scope.sectionGroups; + scope.sectionGroupCosts; + + scope.calculateChangedValues(); + scope.calculateMissingCourses(); + scope.calculateAddedCourses(); + }; + + scope.calculateChangedValues = function () { + scope.sectionGroupCosts.ids.forEach(function(sectionGroupCostId) { + var sectionGroupCost = scope.sectionGroupCosts.list[sectionGroupCostId]; + var uniqueKey = sectionGroupCost.subjectCode + "-" + sectionGroupCost.courseNumber + "-" + sectionGroupCost.sequencePattern + "-" + sectionGroupCost.termCode; + var sectionGroup = scope.sectionGroups.byUniqueKey[uniqueKey]; + + // This is a missingCourse, not a changed value + if (!sectionGroup) { return; } + + // Check seats + // Check assigned instructor + // Check enrollment + // Check seats + // Check TAs + // Check Readers + }); + }; + + // // Example changeObject + // var changeObject = { + // sectionGroupCostId: 22 + // parameter: "enrollment" + // value: 22 + // term: "201610" + // }; + + // Recalculate on changes + scope.$watchGroup(['courses', 'sectionGroups', 'sectionGroupCosts'], function(newValues, oldValues, scope) { + scope.calculateChanges(); + }); + + // Calculate on instantation of directive + scope.calculateChanges(); } }; }; diff --git a/app/budget/services/budgetReducers.js b/app/budget/services/budgetReducers.js index e555caed0..fcd3d4f10 100644 --- a/app/budget/services/budgetReducers.js +++ b/app/budget/services/budgetReducers.js @@ -914,7 +914,7 @@ class BudgetReducers { newState.lineItemComments = scope.lineItemCommentReducers(action, scope._state.lineItemComments); newState.lineItemCategories = scope.lineItemCategoryReducers(action, scope._state.lineItemCategories); newState.sectionGroupCosts = scope.sectionGroupCostReducers(action, scope._state.sectionGroupCosts); - newState.sectionGroupCostComments = scope.sectionGroupCostCommentReducers(action, scope._state.sectionGroupCostComments); + newState.sectionGroupCostComments = scope.sectionGroupCostCommentReducers(action, scope._state.sectionGroupCostComments); newState.scheduleSectionGroups = scope.scheduleSectionGroupReducers(action, scope._state.scheduleSectionGroups); newState.assignedInstructors = scope.assignedInstructorReducers(action, scope._state.assignedInstructors); newState.activeInstructors = scope.activeInstructorReducers(action, scope._state.activeInstructors); @@ -947,6 +947,7 @@ class BudgetReducers { newPageState.lineItemCategories = BudgetSelectors.generateLineItemCategories(newState.lineItemCategories); newPageState.courses = newState.courses; newPageState.sectionGroups = newState.sectionGroups; + newPageState.sectionGroupCosts = newState.sectionGroupCosts; newPageState.calculatedCourseList = newState.calculatedCourseList; newPageState.calculatedScheduleCosts = newState.calculatedScheduleCosts; From c254c32ae5d9241566444704125cc34f132b5309 Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Wed, 28 Nov 2018 11:51:57 -0800 Subject: [PATCH 03/35] Add budgetScenario check on incomingChange calculations --- app/budget/BudgetCtrl.html | 3 ++- app/budget/directives/incomingChanges/incomingChanges.js | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/budget/BudgetCtrl.html b/app/budget/BudgetCtrl.html index 4b67ab7d9..381a07c76 100644 --- a/app/budget/BudgetCtrl.html +++ b/app/budget/BudgetCtrl.html @@ -105,7 +105,8 @@ courses="view.state.courses" section-groups="view.state.sectionGroups" section-group-costs="view.state.sectionGroupCosts" - term-nav="view.state.ui.termNav"> + term-nav="view.state.ui.termNav" + selected-budget-scenario="view.state.selectedBudgetScenario"> diff --git a/app/budget/directives/incomingChanges/incomingChanges.js b/app/budget/directives/incomingChanges/incomingChanges.js index 9c444f59d..ddf3f9cd5 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.js +++ b/app/budget/directives/incomingChanges/incomingChanges.js @@ -9,7 +9,8 @@ let incomingChanges = function (BudgetActions) { termNav: '<', sectionGroups: '<', courses: '<', - sectionGroupCosts: '<' + sectionGroupCosts: '<', + selectedBudgetScenario: '<' }, link: function (scope, element, attrs) { // Total of differences, by term @@ -33,7 +34,10 @@ let incomingChanges = function (BudgetActions) { var uniqueKey = sectionGroupCost.subjectCode + "-" + sectionGroupCost.courseNumber + "-" + sectionGroupCost.sequencePattern + "-" + sectionGroupCost.termCode; var sectionGroup = scope.sectionGroups.byUniqueKey[uniqueKey]; - // This is a missingCourse, not a changed value + // Ensure sectionGroupCost matches scenario + if (sectionGroupCost.budgetScenario != scope.selectedBudgetScenario.id) { return; } + + // Ensure sectionGroupCost has a match in IPA if (!sectionGroup) { return; } // Check seats From 4642d0b8d43b073ae590bd32d0c8119926c57fbc Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Wed, 12 Dec 2018 10:21:49 -0800 Subject: [PATCH 04/35] Adding pure function helpers for comparison --- .../incomingChanges/incomingChanges.js | 80 +++++++++++++++---- 1 file changed, 64 insertions(+), 16 deletions(-) diff --git a/app/budget/directives/incomingChanges/incomingChanges.js b/app/budget/directives/incomingChanges/incomingChanges.js index ddf3f9cd5..bb714fc2b 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.js +++ b/app/budget/directives/incomingChanges/incomingChanges.js @@ -19,28 +19,29 @@ let incomingChanges = function (BudgetActions) { }; scope.calculateChanges = function () { - scope.courses; - scope.sectionGroups; - scope.sectionGroupCosts; + var scenarioSectionGroupCostIds = scope.getScenarioSectionGroupCostIds(scope.sectionGroupCosts, scope.selectedBudgetScenario); + var scenarioSectionGroupIds = scope.getScenarioSectionGroupIds(scope.sectionGroups, scope.selectedBudgetScenario); + var presentSectionGroupCostIds = scope.getPresentSectionGroupCostIds(scenarioSectionGroupCostIds, scope.sectionGroupCosts, scope.sectionGroups); - scope.calculateChangedValues(); - scope.calculateMissingCourses(); - scope.calculateAddedCourses(); + var changedValues = scope.calculateChangedValues(presentSectionGroupCostIds); + var missingCourses = scope.calculateMissingCourses(scope.sectionGroupIds); + var addedCourses = scope.calculateAddedCourses(sectionGroupIds); + + debugger; }; - scope.calculateChangedValues = function () { - scope.sectionGroupCosts.ids.forEach(function(sectionGroupCostId) { - var sectionGroupCost = scope.sectionGroupCosts.list[sectionGroupCostId]; + // Loops over sectionGroupCosts + scope.calculateChangedValues = function (sectionGroupCostIds) { + sectionGroupCostIds.forEach(function(sectionGroupCostId) { + var sectionGroupCost = sectionGroupCosts.list[sectionGroupCostId]; var uniqueKey = sectionGroupCost.subjectCode + "-" + sectionGroupCost.courseNumber + "-" + sectionGroupCost.sequencePattern + "-" + sectionGroupCost.termCode; - var sectionGroup = scope.sectionGroups.byUniqueKey[uniqueKey]; - - // Ensure sectionGroupCost matches scenario - if (sectionGroupCost.budgetScenario != scope.selectedBudgetScenario.id) { return; } - - // Ensure sectionGroupCost has a match in IPA - if (!sectionGroup) { return; } + var sectionGroupId = sectionGroups.idsByUniqueKey[uniqueKey]; + var sectionGroup = sectionGroups.list[sectionGroupId]; // Check seats + sectionGroup; + sectionGroupCost; + debugger; // Check assigned instructor // Check enrollment // Check seats @@ -49,6 +50,53 @@ let incomingChanges = function (BudgetActions) { }); }; + // Filters provided sectionGroupCostIds to ensure they match a sectionGroup. + scope.getPresentSectionGroupCostIds = function (sectionGroupCostIds, sectionGroupCosts, sectionGroups) { + return sectionGroupCostIds.filter(function(sectionGroupCostId) { + var sectionGroupCost = sectionGroupCosts.list[sectionGroupCostId]; + var uniqueKey = sectionGroupCost.subjectCode + "-" + sectionGroupCost.courseNumber + "-" + sectionGroupCost.sequencePattern + "-" + sectionGroupCost.termCode; + var sectionGroupId = sectionGroups.idsByUniqueKey[uniqueKey]; + var sectionGroup = sectionGroups.list[sectionGroupId]; + + // Ensure sectionGroupCost has a match + if (!sectionGroup) { return false; } + + return true; + }); + }; + + // Filters sectionGroups against selected scenario + scope.getScenarioSectionGroupIds = function (sectionGroups, selectedBudgetScenario) { + return sectionGroups.ids.filter(function(sectionGroupId) { + var sectionGroup = sectionGroups.list[sectionGroupId]; + + // Ensure sectionGroupCost matches scenario + if (sectionGroup.budgetScenarioId != selectedBudgetScenario.id) { return false; } + + return true; + }); + }; + + // Filters sectionGroupCosts against selected scenario + scope.getScenarioSectionGroupCostIds = function (sectionGroupCosts, selectedBudgetScenario) { + return sectionGroupCosts.ids.filter(function(sectionGroupCostId) { + var sectionGroupCost = sectionGroupCosts.list[sectionGroupCostId]; + + // Ensure sectionGroupCost matches scenario + if (sectionGroupCost.budgetScenarioId != selectedBudgetScenario.id) { return false; } + + return true; + }); + }; + + scope.calculateMissingCourses = function () { + + }; + + scope.calculateAddedCourses = function () { + + }; + // // Example changeObject // var changeObject = { // sectionGroupCostId: 22 From 1d5bd29a08bc90b5e8582e01494600ac47e72641 Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Wed, 12 Dec 2018 10:49:50 -0800 Subject: [PATCH 05/35] calculate change value rows --- .../incomingChanges/incomingChanges.js | 74 ++++++++++++++++--- 1 file changed, 65 insertions(+), 9 deletions(-) diff --git a/app/budget/directives/incomingChanges/incomingChanges.js b/app/budget/directives/incomingChanges/incomingChanges.js index bb714fc2b..6b22da9dc 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.js +++ b/app/budget/directives/incomingChanges/incomingChanges.js @@ -32,22 +32,78 @@ let incomingChanges = function (BudgetActions) { // Loops over sectionGroupCosts scope.calculateChangedValues = function (sectionGroupCostIds) { + var changes = []; + sectionGroupCostIds.forEach(function(sectionGroupCostId) { - var sectionGroupCost = sectionGroupCosts.list[sectionGroupCostId]; + var sectionGroupCost = scope.sectionGroupCosts.list[sectionGroupCostId]; var uniqueKey = sectionGroupCost.subjectCode + "-" + sectionGroupCost.courseNumber + "-" + sectionGroupCost.sequencePattern + "-" + sectionGroupCost.termCode; - var sectionGroupId = sectionGroups.idsByUniqueKey[uniqueKey]; - var sectionGroup = sectionGroups.list[sectionGroupId]; + var sectionGroupId = scope.sectionGroups.idsByUniqueKey[uniqueKey]; + var sectionGroup = scope.sectionGroups.list[sectionGroupId]; - // Check seats - sectionGroup; - sectionGroupCost; - debugger; - // Check assigned instructor // Check enrollment - // Check seats + if (sectionGroup.totalSeats != sectionGroupCost.enrollment) { + var change = { + sectionGroupCost: sectionGroupCost, + enrollment: sectionGroup.totalSeats + }; + + changes.push(change); + } + // Check TAs + if (sectionGroup.teachingAssistantAppointments != sectionGroupCost.taCount) { + var change = { + sectionGroupCost: sectionGroupCost, + taCount: sectionGroup.teachingAssistantAppointments + }; + + changes.push(change); + } + // Check Readers + if (sectionGroup.readerAppointments != sectionGroupCost.readerCount) { + var change = { + sectionGroupCost: sectionGroupCost, + readerCount: sectionGroup.readerAppointments + }; + + changes.push(change); + } + + // Check assigned instructor / instructorType + var sectionGroupInstructorId = sectionGroup.assignedInstructorIds[0]; + var sectionGroupInstructorTypeId = sectionGroup.assignedInstructorTypeIds[0]; + var sectionGroupCostInstructorId = sectionGroupCost.instructorId; + var sectionGroupCostInstructorTypeId = sectionGroupCost.instructorTypeId; + + if (sectionGroupInstructorId != sectionGroupCostInstructorId) { + var change = { + sectionGroupCost: sectionGroupCost, + instructorId: sectionGroupInstructorId + }; + + changes.push(change); + } else if (sectionGroupInstructorTypeId != sectionGroupCostInstructorId) { + var change = { + sectionGroupCost: sectionGroupCost, + instructorTypeId: sectionGroupInstructorTypeId + }; + + changes.push(change); + } + + // Check section count + if (sectionGroup.sectionCount != sectionGroupCost.sectionCount) { + var change = { + sectionGroupCost: sectionGroupCost, + sectionCount: sectionGroup.sectionCount + }; + + changes.push(change); + } }); + + return changes; }; // Filters provided sectionGroupCostIds to ensure they match a sectionGroup. From 3ca1db7ff46892dfe1dac36afec6c04f1669dd07 Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Wed, 12 Dec 2018 12:16:32 -0800 Subject: [PATCH 06/35] Add missing course calculations --- .../incomingChanges/incomingChanges.js | 62 ++++++++++--------- 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/app/budget/directives/incomingChanges/incomingChanges.js b/app/budget/directives/incomingChanges/incomingChanges.js index 6b22da9dc..aaae6b3df 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.js +++ b/app/budget/directives/incomingChanges/incomingChanges.js @@ -19,13 +19,11 @@ let incomingChanges = function (BudgetActions) { }; scope.calculateChanges = function () { - var scenarioSectionGroupCostIds = scope.getScenarioSectionGroupCostIds(scope.sectionGroupCosts, scope.selectedBudgetScenario); - var scenarioSectionGroupIds = scope.getScenarioSectionGroupIds(scope.sectionGroups, scope.selectedBudgetScenario); + var scenarioSectionGroupCostIds = scope.getActiveSectionGroupCostIds(scope.sectionGroupCosts, scope.selectedBudgetScenario); var presentSectionGroupCostIds = scope.getPresentSectionGroupCostIds(scenarioSectionGroupCostIds, scope.sectionGroupCosts, scope.sectionGroups); - var changedValues = scope.calculateChangedValues(presentSectionGroupCostIds); - var missingCourses = scope.calculateMissingCourses(scope.sectionGroupIds); - var addedCourses = scope.calculateAddedCourses(sectionGroupIds); + var missingCourses = scope.calculateMissingCourses(); + var addedCourses = scope.calculateAddedCourses(scenarioSectionGroupCostIds); debugger; }; @@ -83,7 +81,7 @@ let incomingChanges = function (BudgetActions) { }; changes.push(change); - } else if (sectionGroupInstructorTypeId != sectionGroupCostInstructorId) { + } else if (sectionGroupInstructorTypeId != sectionGroupCostInstructorTypeId) { var change = { sectionGroupCost: sectionGroupCost, instructorTypeId: sectionGroupInstructorTypeId @@ -121,46 +119,54 @@ let incomingChanges = function (BudgetActions) { }); }; - // Filters sectionGroups against selected scenario - scope.getScenarioSectionGroupIds = function (sectionGroups, selectedBudgetScenario) { - return sectionGroups.ids.filter(function(sectionGroupId) { - var sectionGroup = sectionGroups.list[sectionGroupId]; - - // Ensure sectionGroupCost matches scenario - if (sectionGroup.budgetScenarioId != selectedBudgetScenario.id) { return false; } - - return true; - }); - }; - - // Filters sectionGroupCosts against selected scenario - scope.getScenarioSectionGroupCostIds = function (sectionGroupCosts, selectedBudgetScenario) { + // Filters sectionGroupCosts against selected scenario and activeTerms + scope.getActiveSectionGroupCostIds = function (sectionGroupCosts, selectedBudgetScenario) { return sectionGroupCosts.ids.filter(function(sectionGroupCostId) { var sectionGroupCost = sectionGroupCosts.list[sectionGroupCostId]; // Ensure sectionGroupCost matches scenario if (sectionGroupCost.budgetScenarioId != selectedBudgetScenario.id) { return false; } + // Ensure sectionGroupCost matches termCode + var activeTerm = scope.selectedBudgetScenario.terms; + if (sectionGroupCost.termCode.slice(-2) != activeTerm) { return false; } + return true; }); }; + // Returns change objects with sectionGroups that need a corresponding sectionGroupCost created scope.calculateMissingCourses = function () { + var changes = []; + + scope.sectionGroups.ids.forEach(function(sectionGroupId) { + var sectionGroup = scope.sectionGroups.list[sectionGroupId]; + var sectionGroupTerm = sectionGroup.termCode.slice(-2); + + // Ensure sectionGroupCost matches termCode + if (scope.selectedBudgetScenario.terms.indexOf(sectionGroupCostTerm) == -1) { return; } + + var uniqueKey = sectionGroup.subjectCode + "-" + sectionGroup.courseNumber + "-" + sectionGroup.sequencePattern + "-" + sectionGroup.termCode + "-" + scope.selectedBudgetScenario.id; + var sectionGroupCostId = scope.sectionGroupCosts.idsByUniqueKey[uniqueKey]; + + // No matching sectionGroupCost found for this sectionGroup + if (!sectionGroupCostId) { + var change = { + sectionGroup: sectionGroup, + sectionGroupCost: null + }; + changes.push(change); + } + }); + + return changes; }; scope.calculateAddedCourses = function () { }; - // // Example changeObject - // var changeObject = { - // sectionGroupCostId: 22 - // parameter: "enrollment" - // value: 22 - // term: "201610" - // }; - // Recalculate on changes scope.$watchGroup(['courses', 'sectionGroups', 'sectionGroupCosts'], function(newValues, oldValues, scope) { scope.calculateChanges(); From 698b79c7dd697e5512d1ab6a6eae5231679fe64b Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Thu, 13 Dec 2018 11:14:38 -0800 Subject: [PATCH 07/35] Fix issues in value change calculations --- app/budget/directives/incomingChanges/incomingChanges.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/budget/directives/incomingChanges/incomingChanges.js b/app/budget/directives/incomingChanges/incomingChanges.js index aaae6b3df..29c25c431 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.js +++ b/app/budget/directives/incomingChanges/incomingChanges.js @@ -128,8 +128,10 @@ let incomingChanges = function (BudgetActions) { if (sectionGroupCost.budgetScenarioId != selectedBudgetScenario.id) { return false; } // Ensure sectionGroupCost matches termCode - var activeTerm = scope.selectedBudgetScenario.terms; - if (sectionGroupCost.termCode.slice(-2) != activeTerm) { return false; } + var activeTerms = scope.selectedBudgetScenario.terms; + var sectionGroupCostTerm = sectionGroupCost.termCode.slice(-2); + + if (activeTerms.indexOf(sectionGroupCostTerm) == -1) { return false; } return true; }); @@ -144,7 +146,7 @@ let incomingChanges = function (BudgetActions) { var sectionGroupTerm = sectionGroup.termCode.slice(-2); // Ensure sectionGroupCost matches termCode - if (scope.selectedBudgetScenario.terms.indexOf(sectionGroupCostTerm) == -1) { return; } + if (scope.selectedBudgetScenario.terms.indexOf(sectionGroupTerm) == -1) { return; } var uniqueKey = sectionGroup.subjectCode + "-" + sectionGroup.courseNumber + "-" + sectionGroup.sequencePattern + "-" + sectionGroup.termCode + "-" + scope.selectedBudgetScenario.id; var sectionGroupCostId = scope.sectionGroupCosts.idsByUniqueKey[uniqueKey]; From b72cd8b402dbf64f235ccc1c82985e4e8436dea3 Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Thu, 13 Dec 2018 11:27:53 -0800 Subject: [PATCH 08/35] Fix logic for calculation of courses missing from scenario --- app/budget/directives/incomingChanges/incomingChanges.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/budget/directives/incomingChanges/incomingChanges.js b/app/budget/directives/incomingChanges/incomingChanges.js index 29c25c431..9bcaa6782 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.js +++ b/app/budget/directives/incomingChanges/incomingChanges.js @@ -23,6 +23,7 @@ let incomingChanges = function (BudgetActions) { var presentSectionGroupCostIds = scope.getPresentSectionGroupCostIds(scenarioSectionGroupCostIds, scope.sectionGroupCosts, scope.sectionGroups); var changedValues = scope.calculateChangedValues(presentSectionGroupCostIds); var missingCourses = scope.calculateMissingCourses(); + debugger; var addedCourses = scope.calculateAddedCourses(scenarioSectionGroupCostIds); debugger; @@ -150,9 +151,10 @@ let incomingChanges = function (BudgetActions) { var uniqueKey = sectionGroup.subjectCode + "-" + sectionGroup.courseNumber + "-" + sectionGroup.sequencePattern + "-" + sectionGroup.termCode + "-" + scope.selectedBudgetScenario.id; var sectionGroupCostId = scope.sectionGroupCosts.idsByUniqueKey[uniqueKey]; + var isPresent = scope.sectionGroupCosts.list[sectionGroupCostId] && scope.sectionGroupCosts.list[sectionGroupCostId].disabled == false ? true : false; - // No matching sectionGroupCost found for this sectionGroup - if (!sectionGroupCostId) { + // No matching active sectionGroupCost found for this sectionGroup + if (isPresent == false) { var change = { sectionGroup: sectionGroup, sectionGroupCost: null @@ -166,7 +168,7 @@ let incomingChanges = function (BudgetActions) { }; scope.calculateAddedCourses = function () { - + debugger; }; // Recalculate on changes From 0edf01a918f5c575c09355567c13381da059fb36 Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Thu, 13 Dec 2018 11:42:14 -0800 Subject: [PATCH 09/35] Fixing calculation of courses not persisted, but present in scenario --- .../incomingChanges/incomingChanges.js | 31 ++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/app/budget/directives/incomingChanges/incomingChanges.js b/app/budget/directives/incomingChanges/incomingChanges.js index 9bcaa6782..c79a3c511 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.js +++ b/app/budget/directives/incomingChanges/incomingChanges.js @@ -13,7 +13,6 @@ let incomingChanges = function (BudgetActions) { selectedBudgetScenario: '<' }, link: function (scope, element, attrs) { - // Total of differences, by term scope.setActiveTerm = function(activeTermTab) { BudgetActions.selectTerm(activeTermTab); }; @@ -23,10 +22,7 @@ let incomingChanges = function (BudgetActions) { var presentSectionGroupCostIds = scope.getPresentSectionGroupCostIds(scenarioSectionGroupCostIds, scope.sectionGroupCosts, scope.sectionGroups); var changedValues = scope.calculateChangedValues(presentSectionGroupCostIds); var missingCourses = scope.calculateMissingCourses(); - debugger; var addedCourses = scope.calculateAddedCourses(scenarioSectionGroupCostIds); - - debugger; }; // Loops over sectionGroupCosts @@ -109,6 +105,10 @@ let incomingChanges = function (BudgetActions) { scope.getPresentSectionGroupCostIds = function (sectionGroupCostIds, sectionGroupCosts, sectionGroups) { return sectionGroupCostIds.filter(function(sectionGroupCostId) { var sectionGroupCost = sectionGroupCosts.list[sectionGroupCostId]; + + // Ensure sectionGroupCost is not disabled + if (sectionGroupCost.disabled) { return false; } + var uniqueKey = sectionGroupCost.subjectCode + "-" + sectionGroupCost.courseNumber + "-" + sectionGroupCost.sequencePattern + "-" + sectionGroupCost.termCode; var sectionGroupId = sectionGroups.idsByUniqueKey[uniqueKey]; var sectionGroup = sectionGroups.list[sectionGroupId]; @@ -151,10 +151,10 @@ let incomingChanges = function (BudgetActions) { var uniqueKey = sectionGroup.subjectCode + "-" + sectionGroup.courseNumber + "-" + sectionGroup.sequencePattern + "-" + sectionGroup.termCode + "-" + scope.selectedBudgetScenario.id; var sectionGroupCostId = scope.sectionGroupCosts.idsByUniqueKey[uniqueKey]; - var isPresent = scope.sectionGroupCosts.list[sectionGroupCostId] && scope.sectionGroupCosts.list[sectionGroupCostId].disabled == false ? true : false; + var sectionGroupCost = sectionGroupCostId ? scope.sectionGroupCosts.list[sectionGroupCostId] : null; // No matching active sectionGroupCost found for this sectionGroup - if (isPresent == false) { + if (!sectionGroupCost || sectionGroupCost.disabled) { var change = { sectionGroup: sectionGroup, sectionGroupCost: null @@ -167,8 +167,23 @@ let incomingChanges = function (BudgetActions) { return changes; }; - scope.calculateAddedCourses = function () { - debugger; + scope.calculateAddedCourses = function (sectionGroupCostIds) { + var changes = []; + + sectionGroupCostIds.forEach(function(sectionGroupCostId) { + var sectionGroupCost = scope.sectionGroupCosts.list[sectionGroupCostId]; + if (sectionGroupCost.isBudgeted && sectionGroupCost.isScheduled == false) { + var change = { + sectionGroupCost: sectionGroupCost, + sectionGroup: null + }; + + changes.push(change); + + } + }); + + return changes; }; // Recalculate on changes From 252fc8510127931d3775bcb6e0a683e2f709e686 Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Thu, 13 Dec 2018 11:54:07 -0800 Subject: [PATCH 10/35] Add term filtering to changes in table display --- .../incomingChanges/incomingChanges.html | 16 +--------- .../incomingChanges/incomingChanges.js | 31 ++++++++++++++----- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/app/budget/directives/incomingChanges/incomingChanges.html b/app/budget/directives/incomingChanges/incomingChanges.html index bef02b695..7d12e2021 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.html +++ b/app/budget/directives/incomingChanges/incomingChanges.html @@ -37,22 +37,8 @@ - + - - - - - - - - - - {{ sectionGroupCost.subjectCode }} diff --git a/app/budget/directives/incomingChanges/incomingChanges.js b/app/budget/directives/incomingChanges/incomingChanges.js index c79a3c511..9bfe04093 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.js +++ b/app/budget/directives/incomingChanges/incomingChanges.js @@ -18,11 +18,18 @@ let incomingChanges = function (BudgetActions) { }; scope.calculateChanges = function () { + scope.changes = []; + var scenarioSectionGroupCostIds = scope.getActiveSectionGroupCostIds(scope.sectionGroupCosts, scope.selectedBudgetScenario); var presentSectionGroupCostIds = scope.getPresentSectionGroupCostIds(scenarioSectionGroupCostIds, scope.sectionGroupCosts, scope.sectionGroups); + var changedValues = scope.calculateChangedValues(presentSectionGroupCostIds); var missingCourses = scope.calculateMissingCourses(); var addedCourses = scope.calculateAddedCourses(scenarioSectionGroupCostIds); + + scope.changes = scope.changes.concat(changedValues); + scope.changes = scope.changes.concat(missingCourses); + scope.changes = scope.changes.concat(addedCourses); }; // Loops over sectionGroupCosts @@ -39,7 +46,8 @@ let incomingChanges = function (BudgetActions) { if (sectionGroup.totalSeats != sectionGroupCost.enrollment) { var change = { sectionGroupCost: sectionGroupCost, - enrollment: sectionGroup.totalSeats + enrollment: sectionGroup.totalSeats, + term: sectionGroup.termCode.slice(-2) }; changes.push(change); @@ -49,7 +57,8 @@ let incomingChanges = function (BudgetActions) { if (sectionGroup.teachingAssistantAppointments != sectionGroupCost.taCount) { var change = { sectionGroupCost: sectionGroupCost, - taCount: sectionGroup.teachingAssistantAppointments + taCount: sectionGroup.teachingAssistantAppointments, + term: sectionGroup.termCode.slice(-2) }; changes.push(change); @@ -59,7 +68,8 @@ let incomingChanges = function (BudgetActions) { if (sectionGroup.readerAppointments != sectionGroupCost.readerCount) { var change = { sectionGroupCost: sectionGroupCost, - readerCount: sectionGroup.readerAppointments + readerCount: sectionGroup.readerAppointments, + term: sectionGroup.termCode.slice(-2) }; changes.push(change); @@ -74,14 +84,16 @@ let incomingChanges = function (BudgetActions) { if (sectionGroupInstructorId != sectionGroupCostInstructorId) { var change = { sectionGroupCost: sectionGroupCost, - instructorId: sectionGroupInstructorId + instructorId: sectionGroupInstructorId, + term: sectionGroupCost.termCode.slice(-2) }; changes.push(change); } else if (sectionGroupInstructorTypeId != sectionGroupCostInstructorTypeId) { var change = { sectionGroupCost: sectionGroupCost, - instructorTypeId: sectionGroupInstructorTypeId + instructorTypeId: sectionGroupInstructorTypeId, + term: sectionGroupCost.termCode.slice(-2) }; changes.push(change); @@ -91,7 +103,8 @@ let incomingChanges = function (BudgetActions) { if (sectionGroup.sectionCount != sectionGroupCost.sectionCount) { var change = { sectionGroupCost: sectionGroupCost, - sectionCount: sectionGroup.sectionCount + sectionCount: sectionGroup.sectionCount, + term: sectionGroupCost.termCode.slice(-2) }; changes.push(change); @@ -157,7 +170,8 @@ let incomingChanges = function (BudgetActions) { if (!sectionGroupCost || sectionGroupCost.disabled) { var change = { sectionGroup: sectionGroup, - sectionGroupCost: null + sectionGroupCost: null, + term: sectionGroup.termCode.slice(-2) }; changes.push(change); @@ -175,7 +189,8 @@ let incomingChanges = function (BudgetActions) { if (sectionGroupCost.isBudgeted && sectionGroupCost.isScheduled == false) { var change = { sectionGroupCost: sectionGroupCost, - sectionGroup: null + sectionGroup: null, + term: sectionGroupCost.termCode.slice(-2) }; changes.push(change); From 9363b10ac890fc437ab75fe9659853397d376c76 Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Thu, 13 Dec 2018 13:01:07 -0800 Subject: [PATCH 11/35] Adding table display information --- .../incomingChanges/incomingChanges.js | 107 ++++++++++++++---- 1 file changed, 83 insertions(+), 24 deletions(-) diff --git a/app/budget/directives/incomingChanges/incomingChanges.js b/app/budget/directives/incomingChanges/incomingChanges.js index 9bfe04093..dd60e6d10 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.js +++ b/app/budget/directives/incomingChanges/incomingChanges.js @@ -45,9 +45,16 @@ let incomingChanges = function (BudgetActions) { // Check enrollment if (sectionGroup.totalSeats != sectionGroupCost.enrollment) { var change = { - sectionGroupCost: sectionGroupCost, - enrollment: sectionGroup.totalSeats, - term: sectionGroup.termCode.slice(-2) + payload: { + sectionGroupCost: sectionGroupCost, + enrollment: sectionGroup.totalSeats + }, + term: sectionGroup.termCode.slice(-2), + display: { + description: "Seats", + ipaText: sectionGroup.totalSeats, + scenarioText: sectionGroupCost.enrollment + } }; changes.push(change); @@ -56,9 +63,16 @@ let incomingChanges = function (BudgetActions) { // Check TAs if (sectionGroup.teachingAssistantAppointments != sectionGroupCost.taCount) { var change = { - sectionGroupCost: sectionGroupCost, - taCount: sectionGroup.teachingAssistantAppointments, - term: sectionGroup.termCode.slice(-2) + payload: { + sectionGroupCost: sectionGroupCost, + taCount: sectionGroup.teachingAssistantAppointments + }, + term: sectionGroup.termCode.slice(-2), + display: { + description: "TA Count", + ipaText: sectionGroup.teachingAssistantAppointments, + scenarioText: sectionGroupCost.taCount + } }; changes.push(change); @@ -67,9 +81,16 @@ let incomingChanges = function (BudgetActions) { // Check Readers if (sectionGroup.readerAppointments != sectionGroupCost.readerCount) { var change = { - sectionGroupCost: sectionGroupCost, - readerCount: sectionGroup.readerAppointments, - term: sectionGroup.termCode.slice(-2) + payload: { + sectionGroupCost: sectionGroupCost, + readerCount: sectionGroup.readerAppointments + }, + term: sectionGroup.termCode.slice(-2), + display: { + description: "Reader Count", + ipaText: sectionGroup.readerAppointments, + scenarioText: sectionGroupCost.readerCount + } }; changes.push(change); @@ -83,17 +104,31 @@ let incomingChanges = function (BudgetActions) { if (sectionGroupInstructorId != sectionGroupCostInstructorId) { var change = { - sectionGroupCost: sectionGroupCost, - instructorId: sectionGroupInstructorId, - term: sectionGroupCost.termCode.slice(-2) + payload: { + sectionGroupCost: sectionGroupCost, + instructorId: sectionGroupInstructorId, + }, + term: sectionGroupCost.termCode.slice(-2), + display: { + description: "Instructor", + ipaText: sectionGroup.assignedInstructorNames[0], + scenarioText: sectionGroupCost.instructor ? sectionGroupCost.instructor.description : null + } }; changes.push(change); } else if (sectionGroupInstructorTypeId != sectionGroupCostInstructorTypeId) { var change = { - sectionGroupCost: sectionGroupCost, - instructorTypeId: sectionGroupInstructorTypeId, - term: sectionGroupCost.termCode.slice(-2) + payload: { + sectionGroupCost: sectionGroupCost, + instructorTypeId: sectionGroupInstructorTypeId, + }, + term: sectionGroupCost.termCode.slice(-2), + display: { + description: "Instructor", + ipaText: sectionGroup.assignedInstructorType ? sectionGroup.assignedInstructorType.description : null, + scenarioText: sectionGroupCost.instructorType ? sectionGroupCost.instructorType.description : null + } }; changes.push(change); @@ -102,9 +137,16 @@ let incomingChanges = function (BudgetActions) { // Check section count if (sectionGroup.sectionCount != sectionGroupCost.sectionCount) { var change = { - sectionGroupCost: sectionGroupCost, - sectionCount: sectionGroup.sectionCount, - term: sectionGroupCost.termCode.slice(-2) + payload: { + sectionGroupCost: sectionGroupCost, + sectionCount: sectionGroup.sectionCount, + }, + term: sectionGroupCost.termCode.slice(-2), + display: { + description: "Section Count", + ipaText: sectionGroup.sectionCount, + scenarioText: sectionGroupCost.sectionCount + } }; changes.push(change); @@ -169,9 +211,17 @@ let incomingChanges = function (BudgetActions) { // No matching active sectionGroupCost found for this sectionGroup if (!sectionGroupCost || sectionGroupCost.disabled) { var change = { - sectionGroup: sectionGroup, - sectionGroupCost: null, - term: sectionGroup.termCode.slice(-2) + payload: { + sectionGroup: sectionGroup, + sectionGroupCost: null, + }, + term: sectionGroup.termCode.slice(-2), + display: { + course: "", + description: "", + ipaText: "present", + scenarioText: "missing" + } }; changes.push(change); @@ -186,11 +236,20 @@ let incomingChanges = function (BudgetActions) { sectionGroupCostIds.forEach(function(sectionGroupCostId) { var sectionGroupCost = scope.sectionGroupCosts.list[sectionGroupCostId]; + // Course is on scenario but not on schedule if (sectionGroupCost.isBudgeted && sectionGroupCost.isScheduled == false) { var change = { - sectionGroupCost: sectionGroupCost, - sectionGroup: null, - term: sectionGroupCost.termCode.slice(-2) + payload: { + sectionGroupCost: sectionGroupCost, + sectionGroup: null, + }, + term: sectionGroupCost.termCode.slice(-2), + display: { + course: "", + description: "", + ipaText: "missing", + scenarioText: "present" + } }; changes.push(change); From 4e4220a1388fbfebf84cbc5426dbd1a74ea8d593 Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Fri, 14 Dec 2018 08:38:04 -0800 Subject: [PATCH 12/35] Improving incoming changes layout and styling --- .../incomingChanges/incomingChanges.css | 3 ++ .../incomingChanges/incomingChanges.html | 48 ++++++++++--------- .../incomingChanges/incomingChanges.js | 34 +++++++++---- 3 files changed, 55 insertions(+), 30 deletions(-) diff --git a/app/budget/directives/incomingChanges/incomingChanges.css b/app/budget/directives/incomingChanges/incomingChanges.css index e69de29bb..7b866994a 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.css +++ b/app/budget/directives/incomingChanges/incomingChanges.css @@ -0,0 +1,3 @@ +.incoming-changes__course { + font-weight: bold; +} diff --git a/app/budget/directives/incomingChanges/incomingChanges.html b/app/budget/directives/incomingChanges/incomingChanges.html index 7d12e2021..1e1e818ed 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.html +++ b/app/budget/directives/incomingChanges/incomingChanges.html @@ -6,9 +6,10 @@
- - - + + + + @@ -18,6 +19,11 @@ Course + @@ -39,35 +43,35 @@ diff --git a/app/budget/directives/incomingChanges/incomingChanges.js b/app/budget/directives/incomingChanges/incomingChanges.js index dd60e6d10..40f4764ca 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.js +++ b/app/budget/directives/incomingChanges/incomingChanges.js @@ -30,6 +30,10 @@ let incomingChanges = function (BudgetActions) { scope.changes = scope.changes.concat(changedValues); scope.changes = scope.changes.concat(missingCourses); scope.changes = scope.changes.concat(addedCourses); + + scope.changes = _.sortBy(scope.changes, function (change) { + return change.display.course; + }); }; // Loops over sectionGroupCosts @@ -51,6 +55,8 @@ let incomingChanges = function (BudgetActions) { }, term: sectionGroup.termCode.slice(-2), display: { + course: sectionGroup.subjectCode + " " + sectionGroup.courseNumber, + title: sectionGroup.title, description: "Seats", ipaText: sectionGroup.totalSeats, scenarioText: sectionGroupCost.enrollment @@ -69,6 +75,8 @@ let incomingChanges = function (BudgetActions) { }, term: sectionGroup.termCode.slice(-2), display: { + course: sectionGroup.subjectCode + " " + sectionGroup.courseNumber, + title: sectionGroup.title, description: "TA Count", ipaText: sectionGroup.teachingAssistantAppointments, scenarioText: sectionGroupCost.taCount @@ -87,6 +95,8 @@ let incomingChanges = function (BudgetActions) { }, term: sectionGroup.termCode.slice(-2), display: { + course: sectionGroup.subjectCode + " " + sectionGroup.courseNumber, + title: sectionGroup.title, description: "Reader Count", ipaText: sectionGroup.readerAppointments, scenarioText: sectionGroupCost.readerCount @@ -110,6 +120,8 @@ let incomingChanges = function (BudgetActions) { }, term: sectionGroupCost.termCode.slice(-2), display: { + course: sectionGroup.subjectCode + " " + sectionGroup.courseNumber, + title: sectionGroup.title, description: "Instructor", ipaText: sectionGroup.assignedInstructorNames[0], scenarioText: sectionGroupCost.instructor ? sectionGroupCost.instructor.description : null @@ -125,6 +137,8 @@ let incomingChanges = function (BudgetActions) { }, term: sectionGroupCost.termCode.slice(-2), display: { + course: sectionGroup.subjectCode + " " + sectionGroup.courseNumber, + title: sectionGroup.title, description: "Instructor", ipaText: sectionGroup.assignedInstructorType ? sectionGroup.assignedInstructorType.description : null, scenarioText: sectionGroupCost.instructorType ? sectionGroupCost.instructorType.description : null @@ -143,6 +157,8 @@ let incomingChanges = function (BudgetActions) { }, term: sectionGroupCost.termCode.slice(-2), display: { + course: sectionGroup.subjectCode + " " + sectionGroup.courseNumber, + title: sectionGroup.title, description: "Section Count", ipaText: sectionGroup.sectionCount, scenarioText: sectionGroupCost.sectionCount @@ -217,10 +233,11 @@ let incomingChanges = function (BudgetActions) { }, term: sectionGroup.termCode.slice(-2), display: { - course: "", - description: "", - ipaText: "present", - scenarioText: "missing" + course: sectionGroup.subjectCode + " " + sectionGroup.courseNumber, + title: sectionGroup.title, + description: "Not budgeted", + ipaText: "check", + scenarioText: "" } }; @@ -245,10 +262,11 @@ let incomingChanges = function (BudgetActions) { }, term: sectionGroupCost.termCode.slice(-2), display: { - course: "", - description: "", - ipaText: "missing", - scenarioText: "present" + course: sectionGroupCost.subjectCode + " " + sectionGroupCost.courseNumber, + title: sectionGroupCost.title, + description: "Not scheduled", + ipaText: "", + scenarioText: "check" } }; From aa7d883cdbc65827501f83fdda78d554cb0899b1 Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Fri, 14 Dec 2018 08:41:24 -0800 Subject: [PATCH 13/35] Separate changes into term based arrays to ensure even odd styling --- .../directives/incomingChanges/incomingChanges.html | 2 +- .../directives/incomingChanges/incomingChanges.js | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/budget/directives/incomingChanges/incomingChanges.html b/app/budget/directives/incomingChanges/incomingChanges.html index 1e1e818ed..e60ea3cad 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.html +++ b/app/budget/directives/incomingChanges/incomingChanges.html @@ -41,7 +41,7 @@ - + @@ -59,7 +59,7 @@ {{ change.display.ipaText }} - - + - + - - -
+
+ Change +
+
Scheduled @@ -29,9 +35,7 @@
-
- UI -
+
- - {{ sectionGroupCost.subjectCode }} - +
+ {{ change.display.course }} +
+
+ {{ change.display.title }} +
- {{ sectionGroupCost.courseNumber }} + + {{ change.display.description }} + - {{ sectionGroupCost.title }} + + {{ change.display.ipaText }} - {{ sectionGroupCost.sequencePattern }} + + {{ change.display.scenarioText }} - - + - - - -
{{ change.display.course }} diff --git a/app/budget/directives/incomingChanges/incomingChanges.js b/app/budget/directives/incomingChanges/incomingChanges.js index 40f4764ca..001f63ab4 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.js +++ b/app/budget/directives/incomingChanges/incomingChanges.js @@ -34,6 +34,8 @@ let incomingChanges = function (BudgetActions) { scope.changes = _.sortBy(scope.changes, function (change) { return change.display.course; }); + + scope.changes = scope.breakIntoTerms(scope.changes); }; // Loops over sectionGroupCosts @@ -278,6 +280,17 @@ let incomingChanges = function (BudgetActions) { return changes; }; + scope.breakIntoTerms = function(changes) { + var separatedChanges = {}; + + changes.forEach(function(change) { + separatedChanges[change.term] = separatedChanges[change.term] || []; + separatedChanges[change.term].push(change); + }); + + return separatedChanges; + }; + // Recalculate on changes scope.$watchGroup(['courses', 'sectionGroups', 'sectionGroupCosts'], function(newValues, oldValues, scope) { scope.calculateChanges(); From 9e4518252bb6ae9e5b1c309133c02a6a170efec5 Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Fri, 14 Dec 2018 10:01:52 -0800 Subject: [PATCH 14/35] Adding courseHeaders to incoming changes table --- .../incomingChanges/incomingChanges.css | 6 +- .../incomingChanges/incomingChanges.html | 14 +-- .../incomingChanges/incomingChanges.js | 105 +++++++++++++----- 3 files changed, 91 insertions(+), 34 deletions(-) diff --git a/app/budget/directives/incomingChanges/incomingChanges.css b/app/budget/directives/incomingChanges/incomingChanges.css index 7b866994a..b8fd28c07 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.css +++ b/app/budget/directives/incomingChanges/incomingChanges.css @@ -1,3 +1,7 @@ -.incoming-changes__course { +.incoming-changes__title { font-weight: bold; } + +.incoming-changes__change-text { + color: rgb(153, 153, 153); +} diff --git a/app/budget/directives/incomingChanges/incomingChanges.html b/app/budget/directives/incomingChanges/incomingChanges.html index e60ea3cad..1bd73dd53 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.html +++ b/app/budget/directives/incomingChanges/incomingChanges.html @@ -16,7 +16,6 @@
- Course
@@ -43,16 +42,16 @@
-
- {{ change.display.course }} +
+ {{ change.display.title }}
- {{ change.display.title }} + {{ change.display.subTitle }}
- - {{ change.display.description }} + + {{ change.display.changeText }} @@ -66,8 +65,9 @@ - diff --git a/app/budget/directives/incomingChanges/incomingChanges.js b/app/budget/directives/incomingChanges/incomingChanges.js index 001f63ab4..a2d7e4067 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.js +++ b/app/budget/directives/incomingChanges/incomingChanges.js @@ -32,10 +32,12 @@ let incomingChanges = function (BudgetActions) { scope.changes = scope.changes.concat(addedCourses); scope.changes = _.sortBy(scope.changes, function (change) { - return change.display.course; + return change.sortKey; }); scope.changes = scope.breakIntoTerms(scope.changes); + scope.changes = scope.addCourseHeaders(scope.changes); + debugger; }; // Loops over sectionGroupCosts @@ -56,10 +58,12 @@ let incomingChanges = function (BudgetActions) { enrollment: sectionGroup.totalSeats }, term: sectionGroup.termCode.slice(-2), + courseTitle: sectionGroup.title, + course: sectionGroup.subjectCode + " " + sectionGroup.courseNumber, + sortKey: sectionGroup.subjectCode + sectionGroup.courseNumber + scope.courses.list[sectionGroup.courseId].sequencePattern, display: { - course: sectionGroup.subjectCode + " " + sectionGroup.courseNumber, - title: sectionGroup.title, - description: "Seats", + subTitle: scope.courses.list[sectionGroup.courseId].sequencePattern, + changeText: "Seats", ipaText: sectionGroup.totalSeats, scenarioText: sectionGroupCost.enrollment } @@ -76,10 +80,12 @@ let incomingChanges = function (BudgetActions) { taCount: sectionGroup.teachingAssistantAppointments }, term: sectionGroup.termCode.slice(-2), + courseTitle: sectionGroup.title, + course: sectionGroup.subjectCode + " " + sectionGroup.courseNumber, + sortKey: sectionGroup.subjectCode + sectionGroup.courseNumber + scope.courses.list[sectionGroup.courseId].sequencePattern, display: { - course: sectionGroup.subjectCode + " " + sectionGroup.courseNumber, - title: sectionGroup.title, - description: "TA Count", + subTitle: scope.courses.list[sectionGroup.courseId].sequencePattern, + changeText: "TA Count", ipaText: sectionGroup.teachingAssistantAppointments, scenarioText: sectionGroupCost.taCount } @@ -96,10 +102,12 @@ let incomingChanges = function (BudgetActions) { readerCount: sectionGroup.readerAppointments }, term: sectionGroup.termCode.slice(-2), + courseTitle: sectionGroup.title, + course: sectionGroup.subjectCode + " " + sectionGroup.courseNumber, + sortKey: sectionGroup.subjectCode + sectionGroup.courseNumber + scope.courses.list[sectionGroup.courseId].sequencePattern, display: { - course: sectionGroup.subjectCode + " " + sectionGroup.courseNumber, - title: sectionGroup.title, - description: "Reader Count", + subTitle: scope.courses.list[sectionGroup.courseId].sequencePattern, + changeText: "Reader Count", ipaText: sectionGroup.readerAppointments, scenarioText: sectionGroupCost.readerCount } @@ -121,10 +129,12 @@ let incomingChanges = function (BudgetActions) { instructorId: sectionGroupInstructorId, }, term: sectionGroupCost.termCode.slice(-2), + courseTitle: sectionGroup.title, + course: sectionGroup.subjectCode + " " + sectionGroup.courseNumber, + sortKey: sectionGroup.subjectCode + sectionGroup.courseNumber + scope.courses.list[sectionGroup.courseId].sequencePattern, display: { - course: sectionGroup.subjectCode + " " + sectionGroup.courseNumber, - title: sectionGroup.title, - description: "Instructor", + subTitle: scope.courses.list[sectionGroup.courseId].sequencePattern, + changeText: "Instructor", ipaText: sectionGroup.assignedInstructorNames[0], scenarioText: sectionGroupCost.instructor ? sectionGroupCost.instructor.description : null } @@ -138,10 +148,12 @@ let incomingChanges = function (BudgetActions) { instructorTypeId: sectionGroupInstructorTypeId, }, term: sectionGroupCost.termCode.slice(-2), + courseTitle: sectionGroup.title, + course: sectionGroup.subjectCode + " " + sectionGroup.courseNumber, + sortKey: sectionGroup.subjectCode + sectionGroup.courseNumber + scope.courses.list[sectionGroup.courseId].sequencePattern, display: { - course: sectionGroup.subjectCode + " " + sectionGroup.courseNumber, - title: sectionGroup.title, - description: "Instructor", + subTitle: scope.courses.list[sectionGroup.courseId].sequencePattern, + changeText: "Instructor", ipaText: sectionGroup.assignedInstructorType ? sectionGroup.assignedInstructorType.description : null, scenarioText: sectionGroupCost.instructorType ? sectionGroupCost.instructorType.description : null } @@ -158,10 +170,12 @@ let incomingChanges = function (BudgetActions) { sectionCount: sectionGroup.sectionCount, }, term: sectionGroupCost.termCode.slice(-2), + courseTitle: sectionGroup.title, + course: sectionGroup.subjectCode + " " + sectionGroup.courseNumber, + sortKey: sectionGroup.subjectCode + sectionGroup.courseNumber + scope.courses.list[sectionGroup.courseId].sequencePattern, display: { - course: sectionGroup.subjectCode + " " + sectionGroup.courseNumber, - title: sectionGroup.title, - description: "Section Count", + subTitle: scope.courses.list[sectionGroup.courseId].sequencePattern, + changeText: "Section Count", ipaText: sectionGroup.sectionCount, scenarioText: sectionGroupCost.sectionCount } @@ -234,10 +248,12 @@ let incomingChanges = function (BudgetActions) { sectionGroupCost: null, }, term: sectionGroup.termCode.slice(-2), + courseTitle: sectionGroup.title, + course: sectionGroup.subjectCode + " " + sectionGroup.courseNumber, + sortKey: sectionGroup.subjectCode + sectionGroup.courseNumber + scope.courses.list[sectionGroup.courseId].sequencePattern, display: { - course: sectionGroup.subjectCode + " " + sectionGroup.courseNumber, - title: sectionGroup.title, - description: "Not budgeted", + subTitle: scope.courses.list[sectionGroup.courseId].sequencePattern, + changeText: "Not budgeted", ipaText: "check", scenarioText: "" } @@ -263,17 +279,18 @@ let incomingChanges = function (BudgetActions) { sectionGroup: null, }, term: sectionGroupCost.termCode.slice(-2), + courseTitle: sectionGroupCost.title, + course: sectionGroupCost.subjectCode + " " + sectionGroupCost.courseNumber, + sortKey: sectionGroupCost.subjectCode + sectionGroupCost.courseNumber + sectionGroupCost.sequencePattern, display: { - course: sectionGroupCost.subjectCode + " " + sectionGroupCost.courseNumber, - title: sectionGroupCost.title, - description: "Not scheduled", + subTitle: sectionGroupCost.sequencePattern, + changeText: "Not Scheduled", ipaText: "", scenarioText: "check" } }; changes.push(change); - } }); @@ -291,6 +308,42 @@ let incomingChanges = function (BudgetActions) { return separatedChanges; }; + scope.addCourseHeaders = function (changes) { + var changesWithHeaders = {}; + Object.keys(changes).forEach(function (key) { + var termChanges = changes[key]; + changesWithHeaders[key] = []; + + var courseHeader = null; + + termChanges.forEach(function(change) { + debugger; + if (!courseHeader || courseHeader.display.course != change.display.course) { + courseHeader = { + payload: { + changes: [] + }, + term: change.term, + course: change.course, + courseTitle: change.courseTitle, + sortKey: change.course, + display: { + title: change.course, + subTitle: change.courseTitle + } + }; + + changesWithHeaders[key].push(courseHeader); + } + + courseHeader.payload.changes.push(change); + changesWithHeaders[key].push(change); + }); + }); + + return changesWithHeaders; + }; + // Recalculate on changes scope.$watchGroup(['courses', 'sectionGroups', 'sectionGroupCosts'], function(newValues, oldValues, scope) { scope.calculateChanges(); From 0c89d3168971a5bb32b8dbf6c98c9954609d04ca Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Fri, 14 Dec 2018 10:29:08 -0800 Subject: [PATCH 15/35] Styling courseHeaders in incoming changes --- app/budget/directives/incomingChanges/incomingChanges.css | 4 ++++ app/budget/directives/incomingChanges/incomingChanges.html | 4 ++-- app/budget/directives/incomingChanges/incomingChanges.js | 4 +--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/budget/directives/incomingChanges/incomingChanges.css b/app/budget/directives/incomingChanges/incomingChanges.css index b8fd28c07..bd385ec05 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.css +++ b/app/budget/directives/incomingChanges/incomingChanges.css @@ -5,3 +5,7 @@ .incoming-changes__change-text { color: rgb(153, 153, 153); } + +.incoming-changes__sub-title-indent { + margin-left: 10px; +} diff --git a/app/budget/directives/incomingChanges/incomingChanges.html b/app/budget/directives/incomingChanges/incomingChanges.html index 1bd73dd53..38243be77 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.html +++ b/app/budget/directives/incomingChanges/incomingChanges.html @@ -45,7 +45,7 @@
{{ change.display.title }}
-
+
{{ change.display.subTitle }}
- + {{ change.display.scenarioText }} diff --git a/app/budget/directives/incomingChanges/incomingChanges.js b/app/budget/directives/incomingChanges/incomingChanges.js index a2d7e4067..4a41573f8 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.js +++ b/app/budget/directives/incomingChanges/incomingChanges.js @@ -37,7 +37,6 @@ let incomingChanges = function (BudgetActions) { scope.changes = scope.breakIntoTerms(scope.changes); scope.changes = scope.addCourseHeaders(scope.changes); - debugger; }; // Loops over sectionGroupCosts @@ -317,8 +316,7 @@ let incomingChanges = function (BudgetActions) { var courseHeader = null; termChanges.forEach(function(change) { - debugger; - if (!courseHeader || courseHeader.display.course != change.display.course) { + if (!courseHeader || courseHeader.course != change.course) { courseHeader = { payload: { changes: [] From 51046d43ed9572da534187a4e2c7955dbc9ebfff Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Fri, 14 Dec 2018 10:46:01 -0800 Subject: [PATCH 16/35] Additional course header styling on incoming changes table --- .../incomingChanges/incomingChanges.css | 12 +++++++++ .../incomingChanges/incomingChanges.html | 25 +++++++++++++------ .../incomingChanges/incomingChanges.js | 1 + 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/app/budget/directives/incomingChanges/incomingChanges.css b/app/budget/directives/incomingChanges/incomingChanges.css index bd385ec05..97e8adefc 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.css +++ b/app/budget/directives/incomingChanges/incomingChanges.css @@ -9,3 +9,15 @@ .incoming-changes__sub-title-indent { margin-left: 10px; } + +.incoming-changes__course-divide { + border-bottom: 1px black solid; +} + +.incoming-changes__section-divide { + border-top: 1px #ebebeb solid; +} + +.incoming-changes__course-header-ui { + padding-left: 20%; +} diff --git a/app/budget/directives/incomingChanges/incomingChanges.html b/app/budget/directives/incomingChanges/incomingChanges.html index 38243be77..77ff149d6 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.html +++ b/app/budget/directives/incomingChanges/incomingChanges.html @@ -40,8 +40,8 @@
+
{{ change.display.title }}
@@ -49,22 +49,31 @@ {{ change.display.subTitle }}
+ + + + + + {{ change.display.changeText }} + {{ change.display.ipaText }} + {{ change.display.scenarioText }} - - + + Date: Fri, 14 Dec 2018 10:58:57 -0800 Subject: [PATCH 17/35] Fixing styling issues --- app/budget/directives/incomingChanges/incomingChanges.css | 5 +++++ app/budget/directives/incomingChanges/incomingChanges.html | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/budget/directives/incomingChanges/incomingChanges.css b/app/budget/directives/incomingChanges/incomingChanges.css index 97e8adefc..315ae799f 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.css +++ b/app/budget/directives/incomingChanges/incomingChanges.css @@ -21,3 +21,8 @@ .incoming-changes__course-header-ui { padding-left: 20%; } + +.incoming-changes__table { + width: 100%; + margin-bottom: 20px; +} diff --git a/app/budget/directives/incomingChanges/incomingChanges.html b/app/budget/directives/incomingChanges/incomingChanges.html index 77ff149d6..bb63dc3b1 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.html +++ b/app/budget/directives/incomingChanges/incomingChanges.html @@ -3,8 +3,8 @@ active-tab="termNav.activeTab" select-tab="setActiveTerm" slim="true"> -
- +
+
@@ -16,6 +16,7 @@
+ Course
From eb17a19d6387943939cac374dd8a347b22206a9a Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Fri, 14 Dec 2018 11:28:38 -0800 Subject: [PATCH 18/35] Display 'no changes' appropriately in incoming changes --- .../incomingChanges/incomingChanges.css | 33 ++++++++++++++++++ .../incomingChanges/incomingChanges.html | 34 ++++++++++++------- .../incomingChanges/incomingChanges.js | 13 ++++--- 3 files changed, 63 insertions(+), 17 deletions(-) diff --git a/app/budget/directives/incomingChanges/incomingChanges.css b/app/budget/directives/incomingChanges/incomingChanges.css index 315ae799f..2c738ac47 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.css +++ b/app/budget/directives/incomingChanges/incomingChanges.css @@ -26,3 +26,36 @@ width: 100%; margin-bottom: 20px; } + +.incoming-changes__apply-term { + padding-bottom: 20px; + padding-top: 20px; + display: flex; + justify-content: center; + align-content: center; + border-bottom: 1p solid #ebebeb; +} + +.incoming-changes__table-header { + width: 10%; + border-bottom: 1px solid #ddd; + border-top: 1px solid #ddd; + padding-top: 10px; + padding-bottom: 10px; +} + +.incoming-changes__table-header-container { + border-right: 1px solid #ddd; + padding-left: 15px; + padding-right: 15px; + padding-top: 5px; + padding-bottom: 5px; +} + +.incoming-changes__no-changes { + color: #777; + display: flex; + justify-content: center; + align-items: center; + padding-top: 20px; +} diff --git a/app/budget/directives/incomingChanges/incomingChanges.html b/app/budget/directives/incomingChanges/incomingChanges.html index bb63dc3b1..ffa7ee239 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.html +++ b/app/budget/directives/incomingChanges/incomingChanges.html @@ -4,6 +4,9 @@ select-tab="setActiveTerm" slim="true">
+
+ +
@@ -14,28 +17,28 @@ - - - - - @@ -52,7 +55,7 @@ + + +
-
+
+
Course
-
+
+
Change
-
+
+
Scheduled
-
+
+
Scenario
-
+
+
- -
+
+ No changes +
+
diff --git a/app/budget/directives/incomingChanges/incomingChanges.js b/app/budget/directives/incomingChanges/incomingChanges.js index 11f56a4f5..fab90ef95 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.js +++ b/app/budget/directives/incomingChanges/incomingChanges.js @@ -13,6 +13,8 @@ let incomingChanges = function (BudgetActions) { selectedBudgetScenario: '<' }, link: function (scope, element, attrs) { + scope.totalChanges = {}; + scope.setActiveTerm = function(activeTermTab) { BudgetActions.selectTerm(activeTermTab); }; @@ -309,9 +311,10 @@ let incomingChanges = function (BudgetActions) { scope.addCourseHeaders = function (changes) { var changesWithHeaders = {}; - Object.keys(changes).forEach(function (key) { - var termChanges = changes[key]; - changesWithHeaders[key] = []; + Object.keys(changes).forEach(function (term) { + var termChanges = changes[term]; + changesWithHeaders[term] = []; + scope.totalChanges[term] = changes[term].length; var courseHeader = null; @@ -332,11 +335,11 @@ let incomingChanges = function (BudgetActions) { } }; - changesWithHeaders[key].push(courseHeader); + changesWithHeaders[term].push(courseHeader); } courseHeader.payload.changes.push(change); - changesWithHeaders[key].push(change); + changesWithHeaders[term].push(change); }); }); From 3123145d0b651a089f9c827e03a47fa4e86f249d Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Fri, 14 Dec 2018 11:31:33 -0800 Subject: [PATCH 19/35] Add context to buttons --- app/budget/directives/incomingChanges/incomingChanges.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/budget/directives/incomingChanges/incomingChanges.html b/app/budget/directives/incomingChanges/incomingChanges.html index ffa7ee239..41a5b6d44 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.html +++ b/app/budget/directives/incomingChanges/incomingChanges.html @@ -5,7 +5,7 @@ slim="true">
- +
@@ -55,7 +55,7 @@ -
- Date: Fri, 14 Dec 2018 13:01:28 -0800 Subject: [PATCH 20/35] Fixing display errors in tooltips --- .../incomingChanges/incomingChanges.html | 6 ++-- .../incomingChanges/incomingChanges.js | 34 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/app/budget/directives/incomingChanges/incomingChanges.html b/app/budget/directives/incomingChanges/incomingChanges.html index 41a5b6d44..3b8badde8 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.html +++ b/app/budget/directives/incomingChanges/incomingChanges.html @@ -69,8 +69,8 @@ - - {{ change.display.ipaText }} + + {{ change.display.scheduleText }} @@ -81,7 +81,7 @@ diff --git a/app/budget/directives/incomingChanges/incomingChanges.js b/app/budget/directives/incomingChanges/incomingChanges.js index fab90ef95..b5c555d5c 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.js +++ b/app/budget/directives/incomingChanges/incomingChanges.js @@ -64,8 +64,8 @@ let incomingChanges = function (BudgetActions) { sortKey: sectionGroup.subjectCode + sectionGroup.courseNumber + scope.courses.list[sectionGroup.courseId].sequencePattern, display: { subTitle: scope.courses.list[sectionGroup.courseId].sequencePattern, - changeText: "Seats", - ipaText: sectionGroup.totalSeats, + changeText: "seats", + scheduleText: sectionGroup.totalSeats || '0', scenarioText: sectionGroupCost.enrollment } }; @@ -86,8 +86,8 @@ let incomingChanges = function (BudgetActions) { sortKey: sectionGroup.subjectCode + sectionGroup.courseNumber + scope.courses.list[sectionGroup.courseId].sequencePattern, display: { subTitle: scope.courses.list[sectionGroup.courseId].sequencePattern, - changeText: "TA Count", - ipaText: sectionGroup.teachingAssistantAppointments, + changeText: "TA count", + scheduleText: sectionGroup.teachingAssistantAppointments || '0', scenarioText: sectionGroupCost.taCount } }; @@ -108,8 +108,8 @@ let incomingChanges = function (BudgetActions) { sortKey: sectionGroup.subjectCode + sectionGroup.courseNumber + scope.courses.list[sectionGroup.courseId].sequencePattern, display: { subTitle: scope.courses.list[sectionGroup.courseId].sequencePattern, - changeText: "Reader Count", - ipaText: sectionGroup.readerAppointments, + changeText: "reader count", + scheduleText: sectionGroup.readerAppointments || '0', scenarioText: sectionGroupCost.readerCount } }; @@ -135,8 +135,8 @@ let incomingChanges = function (BudgetActions) { sortKey: sectionGroup.subjectCode + sectionGroup.courseNumber + scope.courses.list[sectionGroup.courseId].sequencePattern, display: { subTitle: scope.courses.list[sectionGroup.courseId].sequencePattern, - changeText: "Instructor", - ipaText: sectionGroup.assignedInstructorNames[0], + changeText: "instructor", + scheduleText: sectionGroup.assignedInstructorNames[0] || 'unassigned', scenarioText: sectionGroupCost.instructor ? sectionGroupCost.instructor.description : null } }; @@ -154,9 +154,9 @@ let incomingChanges = function (BudgetActions) { sortKey: sectionGroup.subjectCode + sectionGroup.courseNumber + scope.courses.list[sectionGroup.courseId].sequencePattern, display: { subTitle: scope.courses.list[sectionGroup.courseId].sequencePattern, - changeText: "Instructor", - ipaText: sectionGroup.assignedInstructorType ? sectionGroup.assignedInstructorType.description : null, - scenarioText: sectionGroupCost.instructorType ? sectionGroupCost.instructorType.description : null + changeText: "instructor", + scheduleText: sectionGroup.assignedInstructorType ? sectionGroup.assignedInstructorType.description : 'unassigned', + scenarioText: sectionGroupCost.instructorType ? sectionGroupCost.instructorType.description : 'unassigned' } }; @@ -176,8 +176,8 @@ let incomingChanges = function (BudgetActions) { sortKey: sectionGroup.subjectCode + sectionGroup.courseNumber + scope.courses.list[sectionGroup.courseId].sequencePattern, display: { subTitle: scope.courses.list[sectionGroup.courseId].sequencePattern, - changeText: "Section Count", - ipaText: sectionGroup.sectionCount, + changeText: "section count", + scheduleText: sectionGroup.sectionCount || '0', scenarioText: sectionGroupCost.sectionCount } }; @@ -254,8 +254,8 @@ let incomingChanges = function (BudgetActions) { sortKey: sectionGroup.subjectCode + sectionGroup.courseNumber + scope.courses.list[sectionGroup.courseId].sequencePattern, display: { subTitle: scope.courses.list[sectionGroup.courseId].sequencePattern, - changeText: "Not budgeted", - ipaText: "check", + changeText: "add course", + scheduleText: "check", scenarioText: "" } }; @@ -285,8 +285,8 @@ let incomingChanges = function (BudgetActions) { sortKey: sectionGroupCost.subjectCode + sectionGroupCost.courseNumber + sectionGroupCost.sequencePattern, display: { subTitle: sectionGroupCost.sequencePattern, - changeText: "Not Scheduled", - ipaText: "", + changeText: "remove course", + scheduleText: "", scenarioText: "check" } }; From 02fea2017a5a8a3eb09cf23640972ba8a6eefcca Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Fri, 14 Dec 2018 13:35:59 -0800 Subject: [PATCH 21/35] Add ability to sync individual changes from incoming changes screen --- .../incomingChanges/incomingChanges.html | 11 ++-- .../incomingChanges/incomingChanges.js | 60 ++++++++++++++++--- 2 files changed, 60 insertions(+), 11 deletions(-) diff --git a/app/budget/directives/incomingChanges/incomingChanges.html b/app/budget/directives/incomingChanges/incomingChanges.html index 3b8badde8..92e257856 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.html +++ b/app/budget/directives/incomingChanges/incomingChanges.html @@ -5,7 +5,10 @@ slim="true">
- + +
@@ -58,8 +61,8 @@ + confirm-message="'Are you sure you want to apply changes to ' + change.course + '?'" + on-click="applyChange(change)"> @@ -82,7 +85,7 @@ size="'small'" skin="'dark'" confirm-message="'Are you sure you want to set ' + change.display.changeText + ' to ' + change.display.scheduleText + '?'" - on-click="hide(sectionGroupCost)"> + on-click="applyChange(change)"> diff --git a/app/budget/directives/incomingChanges/incomingChanges.js b/app/budget/directives/incomingChanges/incomingChanges.js index b5c555d5c..c8345d06d 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.js +++ b/app/budget/directives/incomingChanges/incomingChanges.js @@ -1,16 +1,16 @@ import './incomingChanges.css'; -let incomingChanges = function (BudgetActions) { +let incomingChanges = function (BudgetActions, $rootScope) { return { restrict: 'E', template: require('./incomingChanges.html'), replace: true, scope: { - termNav: '<', - sectionGroups: '<', - courses: '<', - sectionGroupCosts: '<', - selectedBudgetScenario: '<' + termNav: '=', + sectionGroups: '=', + courses: '=', + sectionGroupCosts: '=', + selectedBudgetScenario: '=' }, link: function (scope, element, attrs) { scope.totalChanges = {}; @@ -245,6 +245,7 @@ let incomingChanges = function (BudgetActions) { if (!sectionGroupCost || sectionGroupCost.disabled) { var change = { payload: { + type: "create", sectionGroup: sectionGroup, sectionGroupCost: null, }, @@ -276,6 +277,7 @@ let incomingChanges = function (BudgetActions) { if (sectionGroupCost.isBudgeted && sectionGroupCost.isScheduled == false) { var change = { payload: { + type: "remove", sectionGroupCost: sectionGroupCost, sectionGroup: null, }, @@ -346,8 +348,52 @@ let incomingChanges = function (BudgetActions) { return changesWithHeaders; }; + scope.applyTermChanges = function () { + + }; + + scope.applyCourseChanges = function (courseHeader) { + + }; + + scope.applyChange = function (change) { + // Create sectionGroupCost + if (change.payload.type == "create") { + var sectionGroupCost = { + todo: null + }; + debugger; + + //BudgetActions.createSectionGroupCost(sectionGroupCost); + } + + // Disable sectionGroupCost + if (change.payload.type == "remove") { + payload.sectionGroupCost.disabled = true; + BudgetActions.updateSectionGroupCost(payload.sectionGroupCost); + return; + } + + // Update sectionGroupCost + if ('enrollment' in change.payload) { + change.payload.sectionGroupCost.enrollment = change.payload.enrollment; + } else if ('taCount' in change.payload) { + change.payload.sectionGroupCost.taCount = change.payload.taCount; + } else if ('readerCount' in change.payload) { + change.payload.sectionGroupCost.readerCount = change.payload.readerCount; + } else if ('instructorTypeId' in change.payload) { + change.payload.sectionGroupCost.instructorTypeId = change.payload.instructorTypeId; + } else if ('instructorId' in change.payload) { + change.payload.sectionGroupCost.instructorId = change.payload.instructorId; + } else if ('sectionCount' in change.payload) { + change.payload.sectionGroupCost.sectionCount = change.payload.sectionCount; + } + + BudgetActions.updateSectionGroupCost(change.payload.sectionGroupCost); + }; + // Recalculate on changes - scope.$watchGroup(['courses', 'sectionGroups', 'sectionGroupCosts'], function(newValues, oldValues, scope) { + $rootScope.$on('budgetStateChanged', function (event, data) { scope.calculateChanges(); }); From 38e47b37c2dbb04e6bfc37b83c24532729844546 Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Fri, 14 Dec 2018 16:55:15 -0800 Subject: [PATCH 22/35] Add ability to accept all changes for a course --- app/budget/directives/incomingChanges/incomingChanges.html | 2 +- app/budget/directives/incomingChanges/incomingChanges.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/budget/directives/incomingChanges/incomingChanges.html b/app/budget/directives/incomingChanges/incomingChanges.html index 92e257856..7846d7731 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.html +++ b/app/budget/directives/incomingChanges/incomingChanges.html @@ -62,7 +62,7 @@ size="'small'" skin="'dark'" confirm-message="'Are you sure you want to apply changes to ' + change.course + '?'" - on-click="applyChange(change)"> + on-click="applyCourseChanges(change)"> diff --git a/app/budget/directives/incomingChanges/incomingChanges.js b/app/budget/directives/incomingChanges/incomingChanges.js index c8345d06d..a1ee8d161 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.js +++ b/app/budget/directives/incomingChanges/incomingChanges.js @@ -353,7 +353,9 @@ let incomingChanges = function (BudgetActions, $rootScope) { }; scope.applyCourseChanges = function (courseHeader) { - + courseHeader.payload.changes.forEach(function(change) { + scope.applyChange(change); + }); }; scope.applyChange = function (change) { From 20dbe5d2416c9d248a08bd123fd1a70aa4856208 Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Mon, 17 Dec 2018 06:28:37 -0800 Subject: [PATCH 23/35] Ensure relevant meta-data is available when creating sectionGroupCosts --- .../incomingChanges/incomingChanges.js | 17 +++++++++++------ app/budget/services/actions/budgetActions.js | 8 ++++++++ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/app/budget/directives/incomingChanges/incomingChanges.js b/app/budget/directives/incomingChanges/incomingChanges.js index a1ee8d161..a6b0623d6 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.js +++ b/app/budget/directives/incomingChanges/incomingChanges.js @@ -349,7 +349,11 @@ let incomingChanges = function (BudgetActions, $rootScope) { }; scope.applyTermChanges = function () { - + scope.changes[scope.termNav.activeTerm].forEach(function (change) { + if (change.courseHeader) { + scope.applyCourseChanges(change); + } + }); }; scope.applyCourseChanges = function (courseHeader) { @@ -362,17 +366,18 @@ let incomingChanges = function (BudgetActions, $rootScope) { // Create sectionGroupCost if (change.payload.type == "create") { var sectionGroupCost = { - todo: null + sectionGroupId: change.payload.sectionGroup.id, + disabled: false }; - debugger; - //BudgetActions.createSectionGroupCost(sectionGroupCost); + BudgetActions.createSectionGroupCost(sectionGroupCost); + return; } // Disable sectionGroupCost if (change.payload.type == "remove") { - payload.sectionGroupCost.disabled = true; - BudgetActions.updateSectionGroupCost(payload.sectionGroupCost); + change.payload.sectionGroupCost.disabled = true; + BudgetActions.updateSectionGroupCost(change.payload.sectionGroupCost); return; } diff --git a/app/budget/services/actions/budgetActions.js b/app/budget/services/actions/budgetActions.js index 29a729092..8da3d783a 100644 --- a/app/budget/services/actions/budgetActions.js +++ b/app/budget/services/actions/budgetActions.js @@ -295,6 +295,14 @@ class BudgetActions { sectionGroupCost.unitsLow = course.unitsLow; sectionGroupCost.taCount = sectionGroup.teachingAssistantAppointments; sectionGroupCost.readerCount = sectionGroup.readerAppointments; + sectionGroupCost.title = course.title; + sectionGroupCost.subjectCode = course.subjectCode; + sectionGroupCost.courseNumber = course.courseNumber; + sectionGroupCost.sequencePattern = course.sequencePattern; + sectionGroupCost.sectionCount = sectionGroup.sectionCount; + sectionGroupCost.enrollment = sectionGroup.plannedSeats; + sectionGroupCost.instructorId = sectionGroup.assignedInstructorIds[0]; + sectionGroupCost.instructorTypeId = sectionGroup.assignedInstructorTypeIds[0]; } sectionGroupCost.termCode = TermService.termToTermCode(term, year); From 4eed2fe511a69a51942579dc83adfa1a48f129e1 Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Mon, 17 Dec 2018 06:34:43 -0800 Subject: [PATCH 24/35] Fix bug in calculation of instructorType change --- app/budget/directives/incomingChanges/incomingChanges.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/budget/directives/incomingChanges/incomingChanges.js b/app/budget/directives/incomingChanges/incomingChanges.js index a6b0623d6..e02ad0835 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.js +++ b/app/budget/directives/incomingChanges/incomingChanges.js @@ -124,6 +124,7 @@ let incomingChanges = function (BudgetActions, $rootScope) { var sectionGroupCostInstructorTypeId = sectionGroupCost.instructorTypeId; if (sectionGroupInstructorId != sectionGroupCostInstructorId) { + debugger; var change = { payload: { sectionGroupCost: sectionGroupCost, @@ -142,7 +143,7 @@ let incomingChanges = function (BudgetActions, $rootScope) { }; changes.push(change); - } else if (sectionGroupInstructorTypeId != sectionGroupCostInstructorTypeId) { + } else if (!sectionGroupInstructorId && sectionGroupInstructorTypeId != sectionGroupCostInstructorTypeId) { var change = { payload: { sectionGroupCost: sectionGroupCost, From 05020bb63db5c1b21d6b5308c5e299868b845e12 Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Mon, 17 Dec 2018 06:47:31 -0800 Subject: [PATCH 25/35] Remove debugger --- app/budget/directives/incomingChanges/incomingChanges.js | 1 - 1 file changed, 1 deletion(-) diff --git a/app/budget/directives/incomingChanges/incomingChanges.js b/app/budget/directives/incomingChanges/incomingChanges.js index e02ad0835..1f681ad30 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.js +++ b/app/budget/directives/incomingChanges/incomingChanges.js @@ -124,7 +124,6 @@ let incomingChanges = function (BudgetActions, $rootScope) { var sectionGroupCostInstructorTypeId = sectionGroupCost.instructorTypeId; if (sectionGroupInstructorId != sectionGroupCostInstructorId) { - debugger; var change = { payload: { sectionGroupCost: sectionGroupCost, From 983565e7ef31ab48e94fa7ec6b9e387b14088f50 Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Mon, 17 Dec 2018 06:54:31 -0800 Subject: [PATCH 26/35] Should confirm before applying term changes --- app/budget/directives/incomingChanges/incomingChanges.html | 1 + 1 file changed, 1 insertion(+) diff --git a/app/budget/directives/incomingChanges/incomingChanges.html b/app/budget/directives/incomingChanges/incomingChanges.html index 7846d7731..03e9f09b1 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.html +++ b/app/budget/directives/incomingChanges/incomingChanges.html @@ -7,6 +7,7 @@
From b6870a4763cf354ecfa96c454c97ea44f9b9e857 Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Mon, 17 Dec 2018 07:05:13 -0800 Subject: [PATCH 27/35] Add change count to term headers --- .../directives/incomingChanges/incomingChanges.html | 1 + app/budget/directives/incomingChanges/incomingChanges.js | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/budget/directives/incomingChanges/incomingChanges.html b/app/budget/directives/incomingChanges/incomingChanges.html index 03e9f09b1..33ce32bef 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.html +++ b/app/budget/directives/incomingChanges/incomingChanges.html @@ -2,6 +2,7 @@
diff --git a/app/budget/directives/incomingChanges/incomingChanges.js b/app/budget/directives/incomingChanges/incomingChanges.js index 1f681ad30..c81141268 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.js +++ b/app/budget/directives/incomingChanges/incomingChanges.js @@ -1,6 +1,6 @@ import './incomingChanges.css'; -let incomingChanges = function (BudgetActions, $rootScope) { +let incomingChanges = function (BudgetActions, $rootScope, TermService) { return { restrict: 'E', template: require('./incomingChanges.html'), @@ -14,6 +14,7 @@ let incomingChanges = function (BudgetActions, $rootScope) { }, link: function (scope, element, attrs) { scope.totalChanges = {}; + scope.tabOverrides = {}; scope.setActiveTerm = function(activeTermTab) { BudgetActions.selectTerm(activeTermTab); @@ -38,6 +39,12 @@ let incomingChanges = function (BudgetActions, $rootScope) { }); scope.changes = scope.breakIntoTerms(scope.changes); + + Object.keys(scope.changes).forEach(function(term) { + var changes = scope.changes[term].length > 0 ? " (" + scope.changes[term].length + ")" : ""; + scope.tabOverrides[TermService.getShortTermName(term)] = TermService.getShortTermName(term) + changes; + }); + scope.changes = scope.addCourseHeaders(scope.changes); }; From 4f9ec689cc98c274f02c1bacfd8900e35fc78e7f Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Mon, 17 Dec 2018 07:11:40 -0800 Subject: [PATCH 28/35] Fixing whitespace --- app/budget/BudgetCtrl.html | 46 +++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/app/budget/BudgetCtrl.html b/app/budget/BudgetCtrl.html index 381a07c76..f86297c06 100644 --- a/app/budget/BudgetCtrl.html +++ b/app/budget/BudgetCtrl.html @@ -10,44 +10,44 @@
+ header-text="Add New Budget Scenario"> + state="view.state" + is-visible="view.state.openAddBudgetScenario"> + header-text="Line Item"> + state="view.state" + is-visible="view.state.ui.isAddLineItemModalOpen" + line-item-to-edit="view.state.ui.lineItemToEdit"> + header-text="Terms" + styles="budgetConfigStyles"> + state="view.state" + selected-budget-scenario="view.state.selectedBudgetScenario" + is-visible="view.state.ui.isBudgetConfigModalOpen"> + header-text="Course Comments"> + section-group-cost="view.state.ui.courseCommentsModal.sectionGroupCost" + current-user-login-id="currentUser.loginId" + is-visible="view.state.ui.courseCommentsModal.isOpen"> + header-text="Add Course"> @@ -55,7 +55,7 @@ + header-text="Line Item Comments"> + state="view.state" + selected-budget-scenario="view.state.selectedBudgetScenario"> + course-list="view.state.calculatedCourseList" + term-nav="view.state.ui.termNav" + selected-budget-scenario="view.state.selectedBudgetScenario"> Date: Mon, 17 Dec 2018 07:12:42 -0800 Subject: [PATCH 29/35] Remove debugger line --- app/budget/budgetCtrl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/budget/budgetCtrl.js b/app/budget/budgetCtrl.js index df642d693..2edc9fa2d 100644 --- a/app/budget/budgetCtrl.js +++ b/app/budget/budgetCtrl.js @@ -28,7 +28,7 @@ class BudgetCtrl { this.$rootScope.$on('budgetStateChanged', function (event, data) { _self.$scope.view.state = data; - console.log(data); + // Set the current active budget scenario id if (_self.$scope.view.state.selectedBudgetScenario) { localStorage.setItem('selectedBudgetScenarioId', _self.$scope.view.state.selectedBudgetScenario.id); From 290b8a9278baf35a6467a5e9f8780e6709272034 Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Mon, 17 Dec 2018 07:14:00 -0800 Subject: [PATCH 30/35] Fixing whitespace --- app/budget/directives/incomingChanges/incomingChanges.html | 1 - 1 file changed, 1 deletion(-) diff --git a/app/budget/directives/incomingChanges/incomingChanges.html b/app/budget/directives/incomingChanges/incomingChanges.html index 33ce32bef..f296280c6 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.html +++ b/app/budget/directives/incomingChanges/incomingChanges.html @@ -102,6 +102,5 @@
- From 47412aaaeca73dbaf7fa27807e65cff45d0ed1e8 Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Mon, 17 Dec 2018 07:15:58 -0800 Subject: [PATCH 31/35] Update comment --- app/budget/directives/incomingChanges/incomingChanges.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/budget/directives/incomingChanges/incomingChanges.js b/app/budget/directives/incomingChanges/incomingChanges.js index c81141268..b79a8d322 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.js +++ b/app/budget/directives/incomingChanges/incomingChanges.js @@ -48,7 +48,7 @@ let incomingChanges = function (BudgetActions, $rootScope, TermService) { scope.changes = scope.addCourseHeaders(scope.changes); }; - // Loops over sectionGroupCosts + // Calculate changes for sections present in both the scheduled data and the scenario scope.calculateChangedValues = function (sectionGroupCostIds) { var changes = []; From 8766c4d0c23dd12fe81d31670ffc771e241e3a16 Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Mon, 17 Dec 2018 07:26:04 -0800 Subject: [PATCH 32/35] Fixing layout alignment on incoming changes --- app/budget/directives/incomingChanges/incomingChanges.css | 5 +++-- app/budget/directives/incomingChanges/incomingChanges.html | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/budget/directives/incomingChanges/incomingChanges.css b/app/budget/directives/incomingChanges/incomingChanges.css index 2c738ac47..641ee636a 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.css +++ b/app/budget/directives/incomingChanges/incomingChanges.css @@ -18,8 +18,9 @@ border-top: 1px #ebebeb solid; } -.incoming-changes__course-header-ui { - padding-left: 20%; +.incoming-changes__ui { + text-align: end; + padding-right: 15px; } .incoming-changes__table { diff --git a/app/budget/directives/incomingChanges/incomingChanges.html b/app/budget/directives/incomingChanges/incomingChanges.html index f296280c6..709a1194c 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.html +++ b/app/budget/directives/incomingChanges/incomingChanges.html @@ -81,7 +81,7 @@ {{ change.display.scenarioText }}
+ Date: Mon, 17 Dec 2018 11:36:54 -0800 Subject: [PATCH 33/35] Removing a disabled flag should be treated as an update, not a creation --- .../incomingChanges/incomingChanges.js | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/app/budget/directives/incomingChanges/incomingChanges.js b/app/budget/directives/incomingChanges/incomingChanges.js index b79a8d322..7e148282f 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.js +++ b/app/budget/directives/incomingChanges/incomingChanges.js @@ -249,7 +249,7 @@ let incomingChanges = function (BudgetActions, $rootScope, TermService) { var sectionGroupCost = sectionGroupCostId ? scope.sectionGroupCosts.list[sectionGroupCostId] : null; // No matching active sectionGroupCost found for this sectionGroup - if (!sectionGroupCost || sectionGroupCost.disabled) { + if (!sectionGroupCost) { var change = { payload: { type: "create", @@ -268,6 +268,26 @@ let incomingChanges = function (BudgetActions, $rootScope, TermService) { } }; + changes.push(change); + } else if (sectionGroupCost.disabled) { + var change = { + payload: { + type: "update", + disabled: false, + sectionGroupCost: sectionGroupCost, + }, + term: sectionGroup.termCode.slice(-2), + courseTitle: sectionGroup.title, + course: sectionGroup.subjectCode + " " + sectionGroup.courseNumber, + sortKey: sectionGroup.subjectCode + sectionGroup.courseNumber + scope.courses.list[sectionGroup.courseId].sequencePattern, + display: { + subTitle: scope.courses.list[sectionGroup.courseId].sequencePattern, + changeText: "add course", + scheduleText: "check", + scenarioText: "" + } + }; + changes.push(change); } }); @@ -401,6 +421,8 @@ let incomingChanges = function (BudgetActions, $rootScope, TermService) { change.payload.sectionGroupCost.instructorId = change.payload.instructorId; } else if ('sectionCount' in change.payload) { change.payload.sectionGroupCost.sectionCount = change.payload.sectionCount; + } else if ('disabled' in change.payload) { + change.payload.sectionGroupCost.disabled = change.payload.disabled; } BudgetActions.updateSectionGroupCost(change.payload.sectionGroupCost); From 7ab7d245207517e7b1ce21aa5799ec7030f72a2c Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Mon, 17 Dec 2018 11:44:23 -0800 Subject: [PATCH 34/35] Should capitalize change descriptors --- app/budget/directives/incomingChanges/incomingChanges.css | 1 + 1 file changed, 1 insertion(+) diff --git a/app/budget/directives/incomingChanges/incomingChanges.css b/app/budget/directives/incomingChanges/incomingChanges.css index 641ee636a..f9eb6bd7e 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.css +++ b/app/budget/directives/incomingChanges/incomingChanges.css @@ -4,6 +4,7 @@ .incoming-changes__change-text { color: rgb(153, 153, 153); + text-transform: capitalize; } .incoming-changes__sub-title-indent { From d1e5c9ee88a8678dd3d926f9cdc8cee087ab9328 Mon Sep 17 00:00:00 2001 From: Lloyd Wheeler Date: Mon, 17 Dec 2018 11:51:49 -0800 Subject: [PATCH 35/35] Fix tooltip language on incoming changes --- .../incomingChanges/incomingChanges.html | 2 +- .../incomingChanges/incomingChanges.js | 32 ++++++++++++------- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/app/budget/directives/incomingChanges/incomingChanges.html b/app/budget/directives/incomingChanges/incomingChanges.html index 709a1194c..b7df595d9 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.html +++ b/app/budget/directives/incomingChanges/incomingChanges.html @@ -86,7 +86,7 @@ diff --git a/app/budget/directives/incomingChanges/incomingChanges.js b/app/budget/directives/incomingChanges/incomingChanges.js index 7e148282f..49f2ce68d 100644 --- a/app/budget/directives/incomingChanges/incomingChanges.js +++ b/app/budget/directives/incomingChanges/incomingChanges.js @@ -73,7 +73,8 @@ let incomingChanges = function (BudgetActions, $rootScope, TermService) { subTitle: scope.courses.list[sectionGroup.courseId].sequencePattern, changeText: "seats", scheduleText: sectionGroup.totalSeats || '0', - scenarioText: sectionGroupCost.enrollment + scenarioText: sectionGroupCost.enrollment, + tooltip: "Are you sure you want to set seats to " + (sectionGroup.totalSeats || '0') + "?" } }; @@ -95,7 +96,8 @@ let incomingChanges = function (BudgetActions, $rootScope, TermService) { subTitle: scope.courses.list[sectionGroup.courseId].sequencePattern, changeText: "TA count", scheduleText: sectionGroup.teachingAssistantAppointments || '0', - scenarioText: sectionGroupCost.taCount + scenarioText: sectionGroupCost.taCount, + tooltip: "Are you sure you want to set TAs to " + (sectionGroup.teachingAssistantAppointments || '0') + "?" } }; @@ -117,7 +119,8 @@ let incomingChanges = function (BudgetActions, $rootScope, TermService) { subTitle: scope.courses.list[sectionGroup.courseId].sequencePattern, changeText: "reader count", scheduleText: sectionGroup.readerAppointments || '0', - scenarioText: sectionGroupCost.readerCount + scenarioText: sectionGroupCost.readerCount, + tooltip: "Are you sure you want to set readers to " + (sectionGroup.readerAppointments || '0') + "?" } }; @@ -144,12 +147,14 @@ let incomingChanges = function (BudgetActions, $rootScope, TermService) { subTitle: scope.courses.list[sectionGroup.courseId].sequencePattern, changeText: "instructor", scheduleText: sectionGroup.assignedInstructorNames[0] || 'unassigned', - scenarioText: sectionGroupCost.instructor ? sectionGroupCost.instructor.description : null + scenarioText: sectionGroupCost.instructor ? sectionGroupCost.instructor.description : null, + tooltip: "Are you sure you want to set the instructor to " + (sectionGroup.assignedInstructorNames[0] || 'unassigned') + "?" } }; changes.push(change); } else if (!sectionGroupInstructorId && sectionGroupInstructorTypeId != sectionGroupCostInstructorTypeId) { + var scheduleText = sectionGroup.assignedInstructorType ? sectionGroup.assignedInstructorType.description : 'unassigned'; var change = { payload: { sectionGroupCost: sectionGroupCost, @@ -162,8 +167,9 @@ let incomingChanges = function (BudgetActions, $rootScope, TermService) { display: { subTitle: scope.courses.list[sectionGroup.courseId].sequencePattern, changeText: "instructor", - scheduleText: sectionGroup.assignedInstructorType ? sectionGroup.assignedInstructorType.description : 'unassigned', - scenarioText: sectionGroupCost.instructorType ? sectionGroupCost.instructorType.description : 'unassigned' + scheduleText: scheduleText, + scenarioText: sectionGroupCost.instructorType ? sectionGroupCost.instructorType.description : 'unassigned', + tooltip: "Are you sure you want to set the instructor type to " + scheduleText + "?" } }; @@ -185,7 +191,8 @@ let incomingChanges = function (BudgetActions, $rootScope, TermService) { subTitle: scope.courses.list[sectionGroup.courseId].sequencePattern, changeText: "section count", scheduleText: sectionGroup.sectionCount || '0', - scenarioText: sectionGroupCost.sectionCount + scenarioText: sectionGroupCost.sectionCount, + tooltip: "Are you sure you want to set the section count to " + (sectionGroup.sectionCount || '0') + "?" } }; @@ -264,7 +271,8 @@ let incomingChanges = function (BudgetActions, $rootScope, TermService) { subTitle: scope.courses.list[sectionGroup.courseId].sequencePattern, changeText: "add course", scheduleText: "check", - scenarioText: "" + scenarioText: "", + tooltip: "Are you sure you want to add " + sectionGroup.subjectCode + " " + sectionGroup.courseNumber + "?" } }; @@ -284,7 +292,8 @@ let incomingChanges = function (BudgetActions, $rootScope, TermService) { subTitle: scope.courses.list[sectionGroup.courseId].sequencePattern, changeText: "add course", scheduleText: "check", - scenarioText: "" + scenarioText: "", + tooltip: "Are you sure you want to remove " + sectionGroup.subjectCode + " " + sectionGroup.courseNumber + "?" } }; @@ -316,7 +325,8 @@ let incomingChanges = function (BudgetActions, $rootScope, TermService) { subTitle: sectionGroupCost.sequencePattern, changeText: "remove course", scheduleText: "", - scenarioText: "check" + scenarioText: "check", + tooltip: "Are you sure you want to remove " + sectionGroupCost.subjectCode + " " + sectionGroupCost.courseNumber + "?" } }; @@ -360,7 +370,7 @@ let incomingChanges = function (BudgetActions, $rootScope, TermService) { sortKey: change.course, display: { title: change.course, - subTitle: change.courseTitle + subTitle: change.courseTitle, } };