From fe2da0cdfd977d199d28c3cbefa00bfaa1be2455 Mon Sep 17 00:00:00 2001 From: Bastian Rihm Date: Wed, 29 May 2024 10:58:05 +0200 Subject: [PATCH] Fix LoS speaker order --- .../list-of-speakers-content.component.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/client/src/app/site/pages/meetings/modules/list-of-speakers-content/components/list-of-speakers-content/list-of-speakers-content.component.ts b/client/src/app/site/pages/meetings/modules/list-of-speakers-content/components/list-of-speakers-content/list-of-speakers-content.component.ts index 8b91f57280..97305f814b 100644 --- a/client/src/app/site/pages/meetings/modules/list-of-speakers-content/components/list-of-speakers-content/list-of-speakers-content.component.ts +++ b/client/src/app/site/pages/meetings/modules/list-of-speakers-content/components/list-of-speakers-content/list-of-speakers-content.component.ts @@ -541,11 +541,11 @@ export class ListOfSpeakersContentComponent extends BaseMeetingComponent impleme ); } - private findOperatorSpeaker(pointOfOrder?: boolean): ViewSpeaker | undefined { - return this.waitingSpeakers - .sort((a, b) => b.id - a.id) - .find( - speaker => speaker.user_id === this.operator.operatorId && !!speaker.point_of_order === !!pointOfOrder - ); + private findOperatorSpeaker(pointOfOrder?: boolean): ViewSpeaker | null { + const opSpeakers = this.waitingSpeakers.filter( + speaker => speaker.user_id === this.operator.operatorId && !!speaker.point_of_order === !!pointOfOrder + ); + + return opSpeakers.reduce((acc, curr) => (curr?.weight > acc?.weight ? curr : opSpeakers[0]), null); } }