Fixed: Show only active memberships in member index
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
This commit is contained in:
parent
38d434aef8
commit
85a3abcc82
|
@ -23,7 +23,7 @@ class MemberView
|
||||||
return [
|
return [
|
||||||
'data' => MemberResource::collection(Member::search($filter->search)->query(fn ($q) => $q->select('*')
|
'data' => MemberResource::collection(Member::search($filter->search)->query(fn ($q) => $q->select('*')
|
||||||
->withFilter($filter)
|
->withFilter($filter)
|
||||||
->with('payments.subscription')->with('memberships')->with('courses')->with('subscription')->with('leaderMemberships')->with('ageGroupMemberships')
|
->with('payments.subscription')->with(['memberships' => fn ($query) => $query->active()])->with('courses')->with('subscription')->with('leaderMemberships')->with('ageGroupMemberships')
|
||||||
->withPendingPayment()
|
->withPendingPayment()
|
||||||
->ordered()
|
->ordered()
|
||||||
)->paginate(15)),
|
)->paginate(15)),
|
||||||
|
|
|
@ -127,6 +127,20 @@ class IndexTest extends TestCase
|
||||||
], $response, 'data.data.0.memberships.0');
|
], $response, 'data.data.0.memberships.0');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testItDoesntShowEndedMemberships(): void
|
||||||
|
{
|
||||||
|
$this->withoutExceptionHandling()->login()->loginNami();
|
||||||
|
$group = Group::factory()->create();
|
||||||
|
$member = Member::factory()
|
||||||
|
->defaults()
|
||||||
|
->has(Membership::factory()->for($group)->in('€ Mitglied', 122, 'Wölfling', 234)->ended())
|
||||||
|
->create();
|
||||||
|
|
||||||
|
$response = $this->get('/member');
|
||||||
|
|
||||||
|
$this->assertCount(0, $this->inertia($response, 'data.data.0.memberships'));
|
||||||
|
}
|
||||||
|
|
||||||
public function testItReturnsPayments(): void
|
public function testItReturnsPayments(): void
|
||||||
{
|
{
|
||||||
$this->withoutExceptionHandling()->login()->loginNami();
|
$this->withoutExceptionHandling()->login()->loginNami();
|
||||||
|
|
Loading…
Reference in New Issue