Skip to content

Commit e5d5792

Browse files
committed
fix: only apply instructor changes on sectiongroup head
1 parent 54c501e commit e5d5792

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

app/registrarReconciliationReport/controllers/registrarReconciliationReportCtrl.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,22 +84,27 @@ class registrarReconciliationReportCtrl {
8484
.filter((section) => section.dwHasChanges)
8585
.forEach((section) => {
8686
section.instructors.forEach((instructor) => {
87+
if (!section.groupHead) {
88+
return;
89+
}
90+
const sectionUniqueKey = isNaN(Number(section.sequenceNumber)) ? section.uniqueKey.slice(0, -2) : section.uniqueKey;
91+
8792
if (instructor.noRemote) {
8893
updates.push({
8994
section: section,
9095
property: 'unassign',
9196
instructor: instructor,
92-
uniqueKey: section.uniqueKey,
97+
uniqueKey: sectionUniqueKey,
9398
isChecked: true,
9499
});
95100
}
96-
101+
97102
if (instructor.noLocal) {
98103
updates.push({
99104
section: section,
100105
property: 'assign',
101106
instructor: instructor,
102-
uniqueKey: section.uniqueKey,
107+
uniqueKey: sectionUniqueKey,
103108
isChecked: true,
104109
});
105110
}

app/registrarReconciliationReport/services/registrarReconciliationReportStateService.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,11 @@ class RegistrarReconciliationReportStateService {
197197
sections.ids.sort();
198198

199199
// Flag the first section in a sectionGroup as a groupHead
200-
var uniqSectionGroupKeys = [];
200+
var groupHeadIds = new Set();
201201
sections.ids.forEach(function (id) {
202-
var uniqueKey = sectionList[id].uniqueKey;
203-
if (uniqSectionGroupKeys.indexOf(uniqueKey) < 0) {
204-
uniqSectionGroupKeys.push(uniqueKey);
202+
const sectionGroupId = sectionList[id].sectionGroupId;
203+
if (!groupHeadIds.has(sectionGroupId)) {
204+
groupHeadIds.add(sectionGroupId);
205205
sectionList[id].groupHead = true;
206206
}
207207
});

0 commit comments

Comments
 (0)