From 0eb4490ef5c02021bf0c3e038c5f0edf109b2519 Mon Sep 17 00:00:00 2001 From: jojohoch <joachim.hoch@iqb.hu-berlin.de> Date: Wed, 25 May 2022 14:49:13 +0200 Subject: [PATCH] [player] Do not include always visible page in visible pages --- .../player/src/app/pipes/valid-pages.pipe.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/projects/player/src/app/pipes/valid-pages.pipe.ts b/projects/player/src/app/pipes/valid-pages.pipe.ts index 2f71854d7..471304b57 100644 --- a/projects/player/src/app/pipes/valid-pages.pipe.ts +++ b/projects/player/src/app/pipes/valid-pages.pipe.ts @@ -14,13 +14,15 @@ export class ValidPagesPipe implements PipeTransform { } private getValidPages(pages: Page[]): Record<string, string> { - return pages.reduce( - (validPages: Record<string, string>, page: Page, index: number) => ({ - ...validPages, - [index.toString(10)]: `${this.translateService.instant( - 'pageIndication', { index: index + 1 } - )}` - }), {} - ); + return pages + .filter((page: Page): boolean => !page.alwaysVisible) + .reduce( + (validPages: Record<string, string>, page: Page, index: number) => ({ + ...validPages, + [index.toString(10)]: `${this.translateService.instant( + 'pageIndication', { index: index + 1 } + )}` + }), {} + ); } } -- GitLab