Fixed: Show only active memberships in testers block
continuous-integration/drone/push Build is passing Details

This commit is contained in:
philipp lang 2023-04-29 21:20:04 +02:00
parent d7305c1a2e
commit 45968d7349
2 changed files with 5 additions and 1 deletions

View File

@ -100,6 +100,6 @@ class Membership extends Model
*/
public function scopeTrying(Builder $query): Builder
{
return $query->whereHas('activity', fn ($builder) => $builder->where('is_try', true));
return $query->active()->whereHas('activity', fn ($builder) => $builder->where('is_try', true));
}
}

View File

@ -20,6 +20,10 @@ class TestersBlockTest extends TestCase
->defaults()
->has(Membership::factory()->in('Schnuppermitgliedschaft', 7, 'Wölfling', 8)->state(['created_at' => now()->subMonths(10)]))
->create(['firstname' => 'Max', 'lastname' => 'Muster']);
$inactiveMember = Member::factory()
->defaults()
->has(Membership::factory()->ended()->in('Schnuppermitgliedschaft', 7, 'Wölfling', 8)->state(['created_at' => now()->subMonths(10)]))
->create(['firstname' => 'Max', 'lastname' => 'Muster']);
$data = app(TestersBlock::class)->render()['data'];