「個別配慮」の出力順変更
ソート条件を「学年(昇順)→ 出席番号(昇順)」に変更します
This commit is contained in:
@@ -91,7 +91,7 @@
|
||||
}
|
||||
|
||||
const cols = getLabelColsMapping(worksheet, baseCells['児童名'][0].row, ['児童名', '子どもの姿', '保育者援助_配慮_環境構成']);
|
||||
const sortedRecords = records.sort((a, b) => Number(a['レコード番号'].value) - Number(b['レコード番号'].value));
|
||||
const sortedRecords = sort(records);
|
||||
|
||||
for (let i = 0; i < totalPages; i++) {
|
||||
const monthLabelCell = baseCells['月'][i];
|
||||
@@ -120,5 +120,20 @@
|
||||
}
|
||||
}
|
||||
|
||||
function sort(records) {
|
||||
// 1. sort by 出席番号
|
||||
const sortedRecords = records.sort((a, b) => Number(a['出席番号'].value) - Number(b['出席番号'].value));
|
||||
|
||||
// 2. sort by 学年
|
||||
debugger;
|
||||
const termOrder = {};
|
||||
termItems.forEach((item, index) => {
|
||||
termOrder[item.value] = index;
|
||||
});
|
||||
sortedRecords.sort((a, b) => {
|
||||
return termOrder[a["学年"].value] - termOrder[b["学年"].value];
|
||||
});
|
||||
return sortedRecords;
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user