diff --git a/app/Services/DoublerService.php b/app/Services/DoublerService.php index 24efd99..f7a114c 100644 --- a/app/Services/DoublerService.php +++ b/app/Services/DoublerService.php @@ -39,6 +39,7 @@ class DoublerService */ protected function findDoublersForEvent(Event $event, string $mode = 'seating'): array { + // TODO add scoped entry queries to the event model $this->validateEvent($event); $entries = $event->entries()->with('audition')->with('student')->get(); $entries = match ($mode) { diff --git a/tests/Feature/Services/DoublerServiceTest.php b/tests/Feature/Services/DoublerServiceTest.php index edd5df3..691b5aa 100644 --- a/tests/Feature/Services/DoublerServiceTest.php +++ b/tests/Feature/Services/DoublerServiceTest.php @@ -67,12 +67,12 @@ it('returns doublers for an event', function () { $return = $this->doublerService->doublersForEvent($concertEvent); expect(count($return))->toBe(2) - ->and($return[1000]['student']->id)->toBe($allSaxDude->id) + ->and($return[1000]['student_id'])->toBe($allSaxDude->id) ->and($return[1000]['entries']->count())->toBe(3) ->and($return[1001]['entries']->count())->toBe(2); assertArrayNotHasKey(1002, $return); $return = $this->doublerService->doublersForEvent($jazzEvent); expect(count($return))->toBe(1) - ->and($return[1000]['student']->id)->toBe($allSaxDude->id) + ->and($return[1000]['student_id'])->toBe($allSaxDude->id) ->and($return[1000]['entries']->count())->toBe(3); });