Skip to content

Commit 0f3b024

Browse files
committed
remove references to census snapshot code
1 parent 82a8ecb commit 0f3b024

File tree

4 files changed

+37
-52
lines changed

4 files changed

+37
-52
lines changed

app/budget/services/actions/budgetActions.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,7 @@ class BudgetActions {
5555
activeTermCodes.forEach(function(termCode) {
5656
DwService.getDwCensusData(subjectCode, null, termCode).then(function(censuses) {
5757
// match courseNumber and TermCode and inject currentEnrollment number
58-
const currentCensusSnapshot = censuses.filter(function(census) {
59-
return census.snapshotCode == "CURRENT";
60-
});
61-
62-
currentCensusSnapshot.forEach(function(courseCensus) {
58+
censuses.forEach(function(courseCensus) {
6359
sectionGroupCosts.forEach(function(sectionGroupCost) {
6460
const censusSequencePattern = isNaN(Number(courseCensus.sequenceNumber)) ? courseCensus.sequenceNumber.charAt(0) : courseCensus.sequenceNumber;
6561
const sectionGroupCostKey = `${sectionGroupCost.subjectCode}-${sectionGroupCost.courseNumber}-${sectionGroupCost.termCode}-${sectionGroupCost.sequencePattern}`;

app/course/directives/censusChart.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ let censusChart = function ($rootScope, $timeout) {
3030
// Gets the "CURRENT" snapshot of the given property (e.g. currentEnrolledCount, maxEnrollmentCount)
3131
var getCurrentCensusForProperty = function (property) {
3232
var sequenceFilteredCensus = scope.census.filter(function(courseCensus) {
33-
return courseCensus.sequenceNumber.includes(scope.sequencePattern) && courseCensus.snapshotCode === "CURRENT";
33+
return courseCensus.sequenceNumber.includes(scope.sequencePattern);
3434
});
3535

3636
var censusByTermCode = {};

app/scheduleSummaryReport/services/scheduleSummaryReportActionCreators.js

+12-15
Original file line numberDiff line numberDiff line change
@@ -36,29 +36,26 @@ class ScheduleSummaryReportActionCreators {
3636
});
3737
},
3838
_getEnrollmentData: function(year, termCode) {
39-
var SNAPSHOT_CODE = "CURRENT";
4039
var termCode = termService.termToTermCode(termCode, year);
4140
var subjectCodes = this._getScheduleSubjectCodes();
4241

4342
subjectCodes.forEach(function(subjectCode) {
4443
dwService.getDwCensusData(subjectCode, null, termCode).then(function(censusSections) {
4544
censusSections.forEach(function(censusSection) {
46-
if (censusSection.snapshotCode == SNAPSHOT_CODE) {
47-
var censusSectionGroupKey = censusSection.subjectCode + censusSection.courseNumber + sequenceNumberToPattern(censusSection.sequenceNumber);
45+
var censusSectionGroupKey = censusSection.subjectCode + censusSection.courseNumber + sequenceNumberToPattern(censusSection.sequenceNumber);
4846

49-
scheduleSummaryReportStateService._state.sectionGroups.ids.forEach(function(sectionGroupId) {
50-
var sectionGroup = scheduleSummaryReportStateService._state.sectionGroups.list[sectionGroupId];
51-
var sectionGroupUniqueKey = sectionGroup.subjectCode + sectionGroup.courseNumber + sectionGroup.sequencePattern;
47+
scheduleSummaryReportStateService._state.sectionGroups.ids.forEach(function(sectionGroupId) {
48+
var sectionGroup = scheduleSummaryReportStateService._state.sectionGroups.list[sectionGroupId];
49+
var sectionGroupUniqueKey = sectionGroup.subjectCode + sectionGroup.courseNumber + sectionGroup.sequencePattern;
5250

53-
if (sectionGroupUniqueKey == censusSectionGroupKey) {
54-
sectionGroup.sections.forEach(function(section) {
55-
if (section.sequenceNumber == censusSection.sequenceNumber) {
56-
section.enrollment = censusSection.currentEnrolledCount;
57-
}
58-
});
59-
}
60-
});
61-
}
51+
if (sectionGroupUniqueKey == censusSectionGroupKey) {
52+
sectionGroup.sections.forEach(function(section) {
53+
if (section.sequenceNumber == censusSection.sequenceNumber) {
54+
section.enrollment = censusSection.currentEnrolledCount;
55+
}
56+
});
57+
}
58+
});
6259
});
6360
}, function () {
6461
$rootScope.$emit('toast', { message: "Could not retrieve enrollment data.", type: "ERROR" });

app/workloadSummaryReport/services/workloadSummaryActions.js

+23-31
Original file line numberDiff line numberDiff line change
@@ -290,14 +290,9 @@ class WorkloadSummaryActions {
290290
courses.ids.forEach(function (courseId) {
291291
var course = courses.list[courseId];
292292
course.census = [];
293-
var SNAPSHOT_CODE = "CURRENT";
294293

295294
DwService.getDwCensusData(course.subjectCode, course.courseNumber).then(function (courseCensus) {
296-
courseCensus.forEach(function (census) {
297-
if (census.snapshotCode === SNAPSHOT_CODE) {
298-
course.census.push(census);
299-
}
300-
});
295+
course.census = courseCensus;
301296
});
302297
});
303298

@@ -1050,7 +1045,6 @@ class WorkloadSummaryActions {
10501045
}
10511046
});
10521047

1053-
var SNAPSHOT_CODE = "CURRENT";
10541048
var termCodes = this._getScheduleTermCodes(isPreviousYear);
10551049
var subjectCodes = this._getScheduleSubjectCodes();
10561050
var openCalls = WorkloadSummaryReducers._state.calculations.dwCallsOpened;
@@ -1062,31 +1056,29 @@ class WorkloadSummaryActions {
10621056

10631057
DwService.getDwCensusData(subjectCode, null, termCode).then(function(censusSections) {
10641058
censusSections.forEach(function(censusSection) {
1065-
if (censusSection.snapshotCode == SNAPSHOT_CODE) {
1066-
var censusSectionGroupKey = censusSection.subjectCode + censusSection.courseNumber + sequenceNumberToPattern(censusSection.sequenceNumber) + TermService.termCodeToTerm(censusSection.termCode);
1067-
1068-
WorkloadSummaryReducers._state.sectionGroups.ids.forEach(function(sectionGroupId) {
1069-
var sectionGroup = WorkloadSummaryReducers._state.sectionGroups.list[sectionGroupId];
1070-
var course = WorkloadSummaryReducers._state.courses.list[sectionGroup.courseId];
1071-
var sectionGroupUniqueKey = course.subjectCode + course.courseNumber + course.sequencePattern + TermService.termCodeToTerm(sectionGroup.termCode);
1072-
1073-
sectionGroup.maxEnrollment = sectionGroup.maxEnrollment || 0;
1074-
sectionGroup.actualEnrollment = sectionGroup.actualEnrollment || 0;
1075-
sectionGroup.previousEnrollment = sectionGroup.previousEnrollment || 0;
1076-
1077-
if (sectionGroupUniqueKey == censusSectionGroupKey) {
1078-
if (isPreviousYear) {
1079-
sectionGroup.previousEnrollment += censusSection.currentEnrolledCount;
1080-
} else {
1081-
sectionGroup.actualEnrollment += censusSection.currentEnrolledCount;
1082-
sectionGroup.maxEnrollment = 0;
1083-
_self._getSectionsForSectionGroup(sectionGroup).forEach(function(section) {
1084-
sectionGroup.maxEnrollment += section.seats;
1085-
});
1086-
}
1059+
var censusSectionGroupKey = censusSection.subjectCode + censusSection.courseNumber + sequenceNumberToPattern(censusSection.sequenceNumber) + TermService.termCodeToTerm(censusSection.termCode);
1060+
1061+
WorkloadSummaryReducers._state.sectionGroups.ids.forEach(function(sectionGroupId) {
1062+
var sectionGroup = WorkloadSummaryReducers._state.sectionGroups.list[sectionGroupId];
1063+
var course = WorkloadSummaryReducers._state.courses.list[sectionGroup.courseId];
1064+
var sectionGroupUniqueKey = course.subjectCode + course.courseNumber + course.sequencePattern + TermService.termCodeToTerm(sectionGroup.termCode);
1065+
1066+
sectionGroup.maxEnrollment = sectionGroup.maxEnrollment || 0;
1067+
sectionGroup.actualEnrollment = sectionGroup.actualEnrollment || 0;
1068+
sectionGroup.previousEnrollment = sectionGroup.previousEnrollment || 0;
1069+
1070+
if (sectionGroupUniqueKey == censusSectionGroupKey) {
1071+
if (isPreviousYear) {
1072+
sectionGroup.previousEnrollment += censusSection.currentEnrolledCount;
1073+
} else {
1074+
sectionGroup.actualEnrollment += censusSection.currentEnrolledCount;
1075+
sectionGroup.maxEnrollment = 0;
1076+
_self._getSectionsForSectionGroup(sectionGroup).forEach(function(section) {
1077+
sectionGroup.maxEnrollment += section.seats;
1078+
});
10871079
}
1088-
});
1089-
}
1080+
}
1081+
});
10901082
});
10911083

10921084
completedCalls += 1;

0 commit comments

Comments
 (0)