CourseModule constructor never assigns this.number — every module.number is undefined #809

Open
opened 2026-07-23 04:33:41 +00:00 by spikerj · 0 comments
Owner

Bug (found via coverage wave 3, spikersoft-angular PR #551).

CourseModule (projects/spikersoft/src/app/_components/classes/module.ts) declares a constructor parameter number: number and a public number: number field, but the constructor body never runs this.number = number; — it only assigns activity_title, activity_type, lessons, title.

Result: every CourseModule instance has number === undefined, even though classes.ts passes 1..10 for both cp101 and dbs101. The parameter is dead and the public field is permanently undefined.

Currently latent (no reader of module.number found in the classes dir), so no visible breakage — but any UI/logic that later orders or labels modules by .number would silently get undefined.

Fix: add this.number = number; to the constructor.

Pinned as a characterization test in PR #551 (classes.spec.ts) asserting the current undefined behavior and referencing this ticket; flip those assertions to expect 1..10 when fixed.

**Bug (found via coverage wave 3, spikersoft-angular PR #551).** `CourseModule` (`projects/spikersoft/src/app/_components/classes/module.ts`) declares a constructor parameter `number: number` and a `public number: number` field, but the constructor body never runs `this.number = number;` — it only assigns `activity_title`, `activity_type`, `lessons`, `title`. Result: **every** `CourseModule` instance has `number === undefined`, even though `classes.ts` passes `1..10` for both `cp101` and `dbs101`. The parameter is dead and the public field is permanently undefined. Currently latent (no reader of `module.number` found in the classes dir), so no visible breakage — but any UI/logic that later orders or labels modules by `.number` would silently get `undefined`. **Fix:** add `this.number = number;` to the constructor. Pinned as a characterization test in PR #551 (`classes.spec.ts`) asserting the current `undefined` behavior and referencing this ticket; flip those assertions to expect `1..10` when fixed.
Sign in to join this conversation.