diff --git a/modules/fbs-core/web/src/app/dialogs/group-deregister-dialog/group-deregister-dialog.component.ts b/modules/fbs-core/web/src/app/dialogs/group-deregister-dialog/group-deregister-dialog.component.ts index ff6756b5d..7367c494d 100644 --- a/modules/fbs-core/web/src/app/dialogs/group-deregister-dialog/group-deregister-dialog.component.ts +++ b/modules/fbs-core/web/src/app/dialogs/group-deregister-dialog/group-deregister-dialog.component.ts @@ -1,11 +1,12 @@ import { Component, Inject, OnInit } from "@angular/core"; -import { Observable } from "rxjs"; +import { Observable, combineLatest } from "rxjs"; import { GroupRegistrationService } from "../../service/group-registration.sevice"; import { MAT_DIALOG_DATA, MatDialogRef } from "@angular/material/dialog"; import { Participant } from "../../model/Participant"; import { Group } from "../../model/Group"; import { GroupService } from "../../service/group.service"; import { CourseRegistrationService } from "../../service/course-registration.service"; +import { map } from "rxjs/operators"; @Component({ selector: "app-group-deregister-dialog", @@ -40,8 +41,22 @@ export class GroupDeregisterDialogComponent implements OnInit { loadMembers(): void { if (this.data.adding) { - this.members$ = this.courseRegistrationService.getCourseParticipants( - this.data.cid + const courseMembers$ = + this.courseRegistrationService.getCourseParticipants(this.data.cid); + const groupMembers$ = this.groupRegistrationService.getGroupParticipants( + this.data.cid, + this.data.gid + ); + + this.members$ = combineLatest([courseMembers$, groupMembers$]).pipe( + map(([courseMembers, groupMembers]) => + courseMembers.filter( + (courseMember) => + !groupMembers.some( + (groupMember) => groupMember.user.id === courseMember.user.id + ) + ) + ) ); } else { this.members$ = this.groupRegistrationService.getGroupParticipants(