Commit e4d11b39 authored by Lukas Burgey's avatar Lukas Burgey

Fix emtpy vo filtering

parent ff705e6c
...@@ -24,7 +24,10 @@ ...@@ -24,7 +24,10 @@
</mat-accordion> </mat-accordion>
</div> </div>
<ng-template #noVOs> <ng-template #noVOs>
<p> <p *ngIf="combi.prefs.showEmptyVOs">
You are not member in any Virtual Organisations.
</p>
<p *ngIf="!combi.prefs.showEmptyVOs">
You are not member in any Virtual Organisations or all your Virtual Organisations are empty. You are not member in any Virtual Organisations or all your Virtual Organisations are empty.
</p> </p>
</ng-template> </ng-template>
......
...@@ -477,41 +477,15 @@ export class UserService { ...@@ -477,41 +477,15 @@ export class UserService {
public extractVOs(combi: Combination): VO[] { public extractVOs(combi: Combination): VO[] {
if (combi.prefs.showEmptyVOs) { if (combi.prefs.showEmptyVOs) {
// filter out VOs that have no services return combi.user.vos;
return combi.user.vos.filter(
(vo: VO) => combi.user.services.some(
(s: Service) => s.vos.some(
svo => svo.id === vo.id,
),
),
);
} }
return combi.user.vos; // filter out VOs that have no services
return combi.user.vos.filter(
} (vo: VO) => combi.user.services.some(
(s: Service) => s.vos.some(
public vosSrc(): Observable<VO[]> { svo => svo.id === vo.id,
return this.prefs.connect().pipe( ),
combineLatest(
this.user$.asObservable(),
(prefs: Prefs, user: User) => {
const vos = this.voSelector(user);
const services = this.serviceSelector(user);
if (prefs.showEmptyVOs) {
// filter out VOs that have no services
return vos.filter(
(vo: VO) => services.some(
(s: Service) => s.vos.some(
svo => svo.id === vo.id,
),
),
);
}
return vos;
}
), ),
); );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment