Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
## Unreleased

### Changes
- A checklist line that names either of two courses, like SOC 130 or SOC 135 in BA Socio and CERP, HFDS or SDS 200 in BS HE, takes either one. Eight programs have these lines in the 2025 catalogs.
||||||| ee00230
- BA Philosophy's Readings in Speculative Thought slot takes only SPEC, the AMIS code for that course.

## 2.1.22 (2026-11-16)
Expand Down
13 changes: 13 additions & 0 deletions extension/requirements.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,19 @@ console.log('requirements.test.js: surplus electives passed');
}
console.log('requirements.test.js: BSCS special problem and practicum passed');

// An either-or checklist line takes the other course, and a second one is an elective.
{
const row = (code, units) => ({ code, title: '', units, result: 'passed' });
const he = plannerCourseList(UPLB_PROGRAMS.BSHE, null, UPLB_CATALOG);
const thesis = fillRequirementSlots(he, [row('HFDS 200', 3), row('HFDS 200', 3)]);
assert.ok(thesis.has('CERP 200') && thesis.has('CERP 200 (2)'), 'HFDS 200 fills the BS HE thesis rows');
const socio = plannerCourseList(UPLB_PROGRAMS.BASOCIO, null, UPLB_CATALOG);
const both = fillRequirementSlots(socio, [row('SOC 135', 3), row('SOC 130', 3)]);
assert.strictEqual(both.get('SOC 130').code, 'SOC 130');
assert.ok([...both.values()].some(r => r.code === 'SOC 135') && !both.has('SOC 135'), 'the other course counts as an elective');
}
console.log('requirements.test.js: either-or checklist lines passed');

// BA Comm: a restricted elective takes only the subjects its title names.
{
const row = (code) => ({ code, title: '', units: 3, result: 'passed' });
Expand Down
11 changes: 11 additions & 0 deletions extension/src/curriculum.js
Original file line number Diff line number Diff line change
Expand Up @@ -2053,6 +2053,7 @@ const UPLB_PROGRAMS = {
{
"code": "DEVC 40",
"title": "Fundamentals of Educational Communication and Technology",
"alt": ["MST 40"],
"units": 3,
"year": 2,
"sem": "2",
Expand Down Expand Up @@ -3114,6 +3115,7 @@ const UPLB_PROGRAMS = {
{
"code": "CMSC 12",
"title": "Foundations of Computer Science",
"alt": ["AMAT 152"],
"units": 3,
"year": 2,
"sem": "1",
Expand Down Expand Up @@ -4401,6 +4403,7 @@ const UPLB_PROGRAMS = {
{
"code": "SOC 130",
"title": "Social Psychology",
"alt": ["SOC 135"],
"units": 3,
"year": 2,
"sem": "1",
Expand Down Expand Up @@ -4629,6 +4632,7 @@ const UPLB_PROGRAMS = {
{
"code": "SOC 160",
"title": "Social Change",
"alt": ["SOC 165"],
"units": 3,
"year": 4,
"sem": "2",
Expand All @@ -4637,6 +4641,7 @@ const UPLB_PROGRAMS = {
{
"code": "SOC 170",
"title": "Social Problems",
"alt": ["SOC 175"],
"units": 3,
"year": 4,
"sem": "2",
Expand Down Expand Up @@ -4792,6 +4797,7 @@ const UPLB_PROGRAMS = {
{
"code": "ECON 11",
"title": "General Economics",
"alt": ["POSC 10"],
"units": 3,
"year": 1,
"sem": "2",
Expand Down Expand Up @@ -6075,6 +6081,7 @@ const UPLB_PROGRAMS = {
{
"code": "ABT 198",
"title": "Practicum",
"alt": ["ABT 200A"],
"units": 3,
"year": 3,
"sem": "midyear",
Expand Down Expand Up @@ -6126,6 +6133,7 @@ const UPLB_PROGRAMS = {
{
"code": "ABT 200",
"title": "Undergraduate Thesis",
"alt": ["ABT 190"],
"units": 3,
"year": 4,
"sem": "1",
Expand Down Expand Up @@ -6799,6 +6807,7 @@ const UPLB_PROGRAMS = {
{
"code": "CMSC 12",
"title": "Foundations of Computer Science",
"alt": ["AMAT 152"],
"units": 3,
"year": 2,
"sem": "1",
Expand Down Expand Up @@ -6895,6 +6904,7 @@ const UPLB_PROGRAMS = {
{
"code": "AAE 111",
"title": "Farm Management",
"alt": ["AAE 120"],
"units": 3,
"year": 3,
"sem": "1",
Expand Down Expand Up @@ -14071,6 +14081,7 @@ const UPLB_PROGRAMS = {
{
"code": "CERP 200",
"title": "Undergraduate Thesis",
"alt": ["HFDS 200", "SDS 200"],
"units": 3,
"year": 4,
"sem": "1",
Expand Down
12 changes: 8 additions & 4 deletions extension/src/requirements.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,17 @@ const BUILT_IN_EQUIVALENTS = [['KAS 1', 'HIST 1']];
function fillRequirementSlots(courses, rows, substitutions = {}) {
const norm = r => normalizeCourseCode(r.code);
const named = new Set(courses.filter(c => !c.genericRequirement).map(c => normalizeCourseCode(c.code)));
// A checklist row that names either of two courses takes the other one too.
const altOf = new Map(courses.flatMap(c => (c.alt || []).map(a => [a, normalizeCourseCode(c.code)])));
const base = r => named.has(norm(r)) ? norm(r) : altOf.get(norm(r)) || norm(r);
const fill = new Map();
// A repeat enrollment fills the next "CODE (n)" row.
rows.forEach(r => {
let code = norm(r);
for (let n = 2; fill.has(code) && named.has(`${norm(r)} (${n})`); n++) code = `${norm(r)} (${n})`;
[...rows.filter(r => named.has(norm(r))), ...rows.filter(r => !named.has(norm(r)))].forEach(r => {
let code = base(r);
for (let n = 2; fill.has(code) && named.has(`${base(r)} (${n})`); n++) code = `${base(r)} (${n})`;
if (named.has(code) && !fill.has(code)) fill.set(code, r);
});
const filled = new Set([...fill.values()].map(norm));
const used = new Set();
[...Object.entries(substitutions || {}), ...BUILT_IN_EQUIVALENTS].forEach(([req, taken]) => {
const code = normalizeCourseCode(req);
Expand All @@ -90,7 +94,7 @@ function fillRequirementSlots(courses, rows, substitutions = {}) {
const seen = new Set();
const outside = rows.filter(r => {
const code = norm(r);
if (named.has(code) || used.has(code) || seen.has(code)) return false;
if (named.has(code) || used.has(code) || seen.has(code) || filled.has(code)) return false;
// HK 12 repeats once per sport.
if (!/^(HK|PE)\b/.test(code)) seen.add(code);
return true;
Expand Down
Loading