14-04-2026

This commit is contained in:
Kevin Adametz 2026-04-14 18:07:45 +02:00
parent f58c709945
commit 0f82fea88a
72 changed files with 7414 additions and 148 deletions

View file

@ -1,6 +1,5 @@
<?php
use App\Http\Controllers\User\IncentiveController;
use App\Models\Incentive;
use App\Models\IncentiveParticipant;
use App\User;
@ -113,7 +112,7 @@ it('sortiert bei Punktgleichstand Teilnehmer mit Klarnamen (bestaetigte Teilnahm
expect($orderedUserIds)->toBe([$confirmed->user_id, $anonymous->user_id]);
});
it('begrenzt die User-Rangliste auf 30 Plaetze (Gewinner-Zone bleibt max_winners)', function () {
it('zeigt alle Teilnehmer mit Aktivitaet in der User-Rangliste (kein Limit)', function () {
$incentive = Incentive::factory()->create(['max_winners' => 20]);
$makeUser = fn () => User::forceCreate([
@ -130,13 +129,21 @@ it('begrenzt die User-Rangliste auf 30 Plaetze (Gewinner-Zone bleibt max_winners
]);
}
// Teilnehmer ohne Punkte soll nicht erscheinen
IncentiveParticipant::factory()->create([
'incentive_id' => $incentive->id,
'user_id' => $makeUser()->id,
'total_points' => 0,
'qualified_partners' => 0,
'qualified_abos' => 0,
]);
$ranking = IncentiveParticipant::where('incentive_id', $incentive->id)
->withRankingActivity()
->orderByIncentiveLeaderboard()
->limit(IncentiveController::USER_RANKING_DISPLAY_LIMIT)
->get();
expect($ranking)->toHaveCount(30);
expect($ranking)->toHaveCount(35);
});
it('blendet in der User-Ranglogik Teilnehmer ohne Partner, Abo und Punkte aus', function () {