Commit e4d11b39 authored by Lukas Burgey's avatar Lukas Burgey

Fix emtpy vo filtering

parent ff705e6c
......@@ -24,7 +24,10 @@
</mat-accordion>
</div>
<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.
</p>
</ng-template>
......
......@@ -477,41 +477,15 @@ export class UserService {
public extractVOs(combi: Combination): VO[] {
if (combi.prefs.showEmptyVOs) {
// filter out VOs that have no services
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;
}
return combi.user.vos;
}
public vosSrc(): Observable<VO[]> {
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;
}
// filter out VOs that have no services
return combi.user.vos.filter(
(vo: VO) => combi.user.services.some(
(s: Service) => s.vos.some(
svo => svo.id === vo.id,
),
),
);
}
......
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