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); } }