From d4025296fee77feeabd7ba09967313df96052ec7 Mon Sep 17 00:00:00 2001 From: Sean Date: Wed, 26 May 2021 11:32:32 +0200 Subject: [PATCH] Show point-of-order amount in speaker statistics Shows the amount of point of orders in speaker statistics --- .../agenda/list-of-speakers-repository.service.ts | 10 ++++++++++ .../user-statistics/user-statistics.component.html | 4 ++++ .../user-statistics/user-statistics.component.ts | 10 ++++++++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/client/src/app/core/repositories/agenda/list-of-speakers-repository.service.ts b/client/src/app/core/repositories/agenda/list-of-speakers-repository.service.ts index 386ceb28a..afe849305 100644 --- a/client/src/app/core/repositories/agenda/list-of-speakers-repository.service.ts +++ b/client/src/app/core/repositories/agenda/list-of-speakers-repository.service.ts @@ -284,6 +284,16 @@ export class ListOfSpeakersRepositoryService extends BaseHasContentObjectReposit return firstContributions; } + /** + * @returns the amount of point of orders (sync) + */ + public getPooAmount(): number { + const speakers: ViewSpeaker[] = this.getViewModelList() + .flatMap((los: ViewListOfSpeakers) => los.finishedSpeakers) + .filter(speaker => speaker.point_of_order); + return speakers.length || 0; + } + /** * Maps structure-level to speaker. * diff --git a/client/src/app/site/common/components/user-statistics/user-statistics.component.html b/client/src/app/site/common/components/user-statistics/user-statistics.component.html index 05407f4ea..d56282f0e 100644 --- a/client/src/app/site/common/components/user-statistics/user-statistics.component.html +++ b/client/src/app/site/common/components/user-statistics/user-statistics.component.html @@ -10,6 +10,10 @@ {{ 'Number of all requests to speak' | translate }} {{ numberOfWordRequests }} + + {{ 'Thereof point of orders' | translate }} + {{ numberOfPoo }} + {{ 'Unique speakers' | translate }} {{ numberOfUniqueSpeakers }} diff --git a/client/src/app/site/common/components/user-statistics/user-statistics.component.ts b/client/src/app/site/common/components/user-statistics/user-statistics.component.ts index 1802b6e33..9942010ce 100644 --- a/client/src/app/site/common/components/user-statistics/user-statistics.component.ts +++ b/client/src/app/site/common/components/user-statistics/user-statistics.component.ts @@ -30,11 +30,15 @@ export class UserStatisticsComponent extends BaseViewComponentDirective { } public get numberOfUniqueSpeakers(): number { - return this.uniqueSpeakers.length; + return this.uniqueSpeakers?.length || 0; } public get numberOfWordRequests(): number { - return this._numberOfWordRequests; + return this._numberOfWordRequests || 0; + } + + public get numberOfPoo(): number { + return this._numberOfPoo || 0; } /** @@ -84,6 +88,7 @@ export class UserStatisticsComponent extends BaseViewComponentDirective { */ private uniqueSpeakers: ViewSpeaker[] = []; private _numberOfWordRequests = 0; + private _numberOfPoo = 0; private statisticIsOpen = false; private relationSpeakingTimeStructureLevelSubject = new BehaviorSubject([]); @@ -122,6 +127,7 @@ export class UserStatisticsComponent extends BaseViewComponentDirective { } this.relationSpeakingTimeStructureLevelSubject.next(list); this.uniqueSpeakers = this.losRepo.getAllFirstContributions(); + this._numberOfPoo = this.losRepo.getPooAmount(); } /**