Default lessons to a week view on the booking page and in wp-admin
CI / Tests (PHP 8.2) (pull_request) Successful in 1m15s
CI / Tests (PHP 8.1) (pull_request) Successful in 1m16s
CI / No Debug Code (pull_request) Successful in 2s
CI / Coding Standards (pull_request) Successful in 3m15s
CI / PHPStan (pull_request) Successful in 3m14s
CI / Tests (PHP 8.3) (pull_request) Successful in 2m37s
CI / Build Plugin Zip (pull_request) Skipped
CI / Tests (PHP 8.2) (pull_request) Successful in 1m15s
CI / Tests (PHP 8.1) (pull_request) Successful in 1m16s
CI / No Debug Code (pull_request) Successful in 2s
CI / Coding Standards (pull_request) Successful in 3m15s
CI / PHPStan (pull_request) Successful in 3m14s
CI / Tests (PHP 8.3) (pull_request) Successful in 2m37s
CI / Build Plugin Zip (pull_request) Skipped
The front-end booking calendar now opens in the Week view (anchored to the week of the earliest open slot) with List still available. The Scheduler and My Lessons admin pages gain a week calendar (usc_view/usc_week, bucketed via a new generic WeekCalendar::bucket()) and open in it by default; the original table remains as the List view since it carries the HST / e-transfer forms. Closes #76 Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
@@ -63,4 +63,30 @@ class WeekCalendarTest extends TestCase
|
||||
self::assertSame('2026-06-29', $days[0]['date']);
|
||||
self::assertSame('2026-07-05', $days[6]['date']);
|
||||
}
|
||||
|
||||
public function testBucketGroupsItemsByExtractedDay(): void
|
||||
{
|
||||
$items = [
|
||||
['day' => '2026-07-06', 'label' => 'a'],
|
||||
['day' => '2026-07-06', 'label' => 'b'],
|
||||
['day' => '2026-07-09', 'label' => 'c'],
|
||||
['day' => '2026-07-13', 'label' => 'outside'],
|
||||
['day' => '', 'label' => 'dayless'],
|
||||
];
|
||||
|
||||
$days = WeekCalendar::bucket('2026-07-06', $items, static fn (array $i): string => $i['day']);
|
||||
|
||||
self::assertCount(7, $days);
|
||||
self::assertSame('2026-07-06', $days[0]['date']);
|
||||
self::assertSame('2026-07-12', $days[6]['date']);
|
||||
|
||||
self::assertSame(['a', 'b'], array_column($days[0]['items'], 'label'));
|
||||
self::assertSame(['c'], array_column($days[3]['items'], 'label'));
|
||||
self::assertSame([], $days[1]['items']);
|
||||
|
||||
// Items outside the week (or with no day) are not bucketed anywhere.
|
||||
$labels = array_merge(...array_column($days, 'items'));
|
||||
self::assertNotContains('outside', array_column($labels, 'label'));
|
||||
self::assertNotContains('dayless', array_column($labels, 'label'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user