Files
ismis-helper/export-json.js
adrianbonpin 53d5ca6d04 feat(v1.4.0): CSV/Excel/JSON/NextUp exports + hybrid smart year standing
- Export modules (export-csv/json/xlsx) mirroring the PDF layout, plus a
  Next Up import CSV matching the raycast/nextup column contract.
- Hybrid Year Level: View Grades history (exact per-semester standing),
  falling back to units math (prospectus total - lacking), then profile.
  Popup adds a year-mode setting (auto/custom/off).
- On-page button row now offers PDF / CSV / Excel / JSON / Next Up.
- Bump version to 1.4.0.
- Tag-only build workflow with an optional AMO sign step for a signed .xpi;
  separate ci.yml keeps tests on pushes/PRs.
- Tests: year-standing parser tests + export tests (CSV quoting, JSON schema,
  XLSX structure); CI validates XLSX via openpyxl.
2026-08-20 06:45:21 +08:00

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 };
});