v1.4.0: CSV/Excel/JSON/NextUp exports, units-first smart year standing, live export progress bar, AES-GCM at-rest password encryption.
46 lines
1.5 KiB
JavaScript
46 lines
1.5 KiB
JavaScript
(function (root, factory) {
|
|
if (typeof module === 'object' && module.exports) {
|
|
module.exports = factory();
|
|
} else {
|
|
root.ISMIStools = Object.assign(root.ISMIStools || {}, factory());
|
|
}
|
|
})(typeof self !== 'undefined' ? self : this, function () {
|
|
'use strict';
|
|
|
|
// Build a clean, reusable JSON representation of the study load.
|
|
// data: { header, courses, totalUnits, year, period }
|
|
function buildStudyLoadJson(data) {
|
|
const header = data.header || {};
|
|
const courses = (data.courses || []).map((c) => ({
|
|
group: c.group || '',
|
|
courseCode: c.courseCode || '',
|
|
description: c.description || '',
|
|
schedule: c.schedule || '',
|
|
faculty: (c.faculty || c.teacher) || '',
|
|
units: c.units || '',
|
|
status: c.status || ''
|
|
}));
|
|
return {
|
|
meta: {
|
|
program: header.program || '',
|
|
studentName: header.fullName || header.studentName || '',
|
|
studentId: header.studentId || '',
|
|
academicYear: data.year ? String(data.year) : '',
|
|
semester: header.semester || data.period || '',
|
|
yearLevel: header.yearLevel || '',
|
|
totalUnits: data.totalUnits || '',
|
|
generatedAt: new Date().toISOString(),
|
|
extensionVersion: data.extensionVersion || ''
|
|
},
|
|
courses,
|
|
totals: {
|
|
// A study load lists the courses the student is enrolled in for the
|
|
// term; there is no "completed" concept here.
|
|
enrolledUnits: data.totalUnits || ''
|
|
}
|
|
};
|
|
}
|
|
|
|
return { buildStudyLoadJson };
|
|
});
|