Never drop an enrolled class from upcoming lessons; delete a guardian's children with them; pin the panel's line spacing
CI / Tests (PHP 8.2) (pull_request) Successful in 58s
CI / PHPStan (pull_request) Successful in 2m53s
CI / Coding Standards (pull_request) Successful in 2m58s
CI / Tests (PHP 8.3) (pull_request) Successful in 2m47s
CI / Build Plugin Zip (pull_request) Skipped
CI / Tests (PHP 8.1) (pull_request) Successful in 1m1s
CI / No Debug Code (pull_request) Successful in 3s

Three fixes from testing the branch.

A group class was only listed when its schedule resolved to exact
datetimes, which needs a class time *and* a duration — both optional on
the offering form, and the schedule note exists precisely so a studio can
write "Tuesdays 4:00pm" instead. A class configured that way vanished
from the list, which is the one thing this feature must never do. So
Offering::sessionStarts() splits "when does it meet" from "how long does
it run" (sessionWindows() is that plus the duration, unchanged), and
SessionSchedule degrades instead of disappearing: dated rows with an open
end when there is no duration, and a single row carrying
Offering::scheduleLabel() when there is no time to derive dates from.
Only a class whose last day has passed drops out.

Deleting a guardian now deletes the children linked to them, releasing
each one's lessons and enrolments first. A child account is login-less
and exists only so the guardian has somebody to book for; without the
guardian nobody can reach it, book for it, or be billed for it, so it was
left stranded on the roster still holding slots. A `handled` set makes
the re-entrant delete_user each child deletion fires a no-op, and stops a
circular link recursing.

The upcoming panel never stated its own line-height, so a theme setting
line-height: 0 above it — the usual icon-font reset — was inherited
straight through. Below 1 that produces both reported symptoms at once:
stacked lines overlap, and the status pill's background is shorter than
the text in it. Pinned at the same id-level specificity as the rest.

Tests: composer test (863), composer lint, composer cs all pass.

Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
2026-07-30 12:10:43 -03:00
co-authored by Claude Opus 5
parent cb347ffca0
commit c9a1205fc0
14 changed files with 663 additions and 89 deletions
+90
View File
@@ -128,6 +128,96 @@ class OfferingTest extends TestCase
self::assertSame([], $noDuration->sessionWindows());
}
/**
* Knowing *when* a class meets is a separate question from knowing how long
* it runs, so the dates survive a missing duration even though the windows
* (which need both ends) do not.
*/
public function testSessionStartsNeedsNoDuration(): void
{
$noDuration = new Offering(
instructorId: 3,
kind: Offering::KIND_GROUP_CLASS,
title: 'Choir',
termStart: '2026-09-08',
termEnd: '2026-09-22',
classTime: '16:00:00',
);
self::assertSame(
['2026-09-08 16:00:00', '2026-09-15 16:00:00', '2026-09-22 16:00:00'],
$noDuration->sessionStarts()
);
self::assertSame([], $noDuration->sessionWindows());
}
public function testSessionStartsEmptyWithoutADateOrATime(): void
{
$noTime = new Offering(
instructorId: 3,
kind: Offering::KIND_GROUP_CLASS,
title: 'Choir',
termStart: '2026-09-08',
);
self::assertSame([], $noTime->sessionStarts());
$noDate = new Offering(
instructorId: 3,
kind: Offering::KIND_GROUP_CLASS,
title: 'Choir',
classTime: '16:00:00',
);
self::assertSame([], $noDate->sessionStarts());
}
public function testLastClassDayPrefersTheTermEnd(): void
{
$run = new Offering(
instructorId: 3,
kind: Offering::KIND_GROUP_CLASS,
title: 'Choir',
termStart: '2026-09-08',
termEnd: '2026-12-08',
);
self::assertSame('2026-12-08', $run->lastClassDay());
$oneOff = new Offering(
instructorId: 3,
kind: Offering::KIND_GROUP_CLASS,
title: 'Recital',
termStart: '2026-09-08',
);
self::assertSame('2026-09-08', $oneOff->lastClassDay());
$undated = new Offering(instructorId: 3, kind: Offering::KIND_GROUP_CLASS, title: 'Choir');
self::assertNull($undated->lastClassDay());
}
/**
* The studio's own wording wins: the schedule-note field exists precisely so
* a class can describe when it meets without being pinned to a clock.
*/
public function testScheduleLabelPrefersTheScheduleNote(): void
{
$offering = new Offering(
instructorId: 3,
kind: Offering::KIND_GROUP_CLASS,
title: 'Choir',
termStart: '2026-09-08',
termEnd: '2026-12-08',
scheduleNote: ' Tuesdays 4:00pm ',
);
self::assertSame('Tuesdays 4:00pm', $offering->scheduleLabel());
}
public function testScheduleLabelSaysSoWhenNothingIsSet(): void
{
$offering = new Offering(instructorId: 3, kind: Offering::KIND_GROUP_CLASS, title: 'Choir');
self::assertSame('Schedule to be confirmed', $offering->scheduleLabel());
}
public function testDefaults(): void
{
$offering = new Offering(1, Offering::KIND_GROUP_CLASS, 'Choir');