From ddb0857716aeb6b6ff4efe34d4f79663aa0d9649 Mon Sep 17 00:00:00 2001 From: Tobias Kohr Date: Mon, 13 Nov 2023 11:03:45 +0100 Subject: [PATCH] review(metadata-info): simplify updateFrequency getter --- .../metadata-info/metadata-info.component.ts | 23 ++++--------------- 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/libs/ui/elements/src/lib/metadata-info/metadata-info.component.ts b/libs/ui/elements/src/lib/metadata-info/metadata-info.component.ts index c32ecc9ed9..18b1990b20 100644 --- a/libs/ui/elements/src/lib/metadata-info/metadata-info.component.ts +++ b/libs/ui/elements/src/lib/metadata-info/metadata-info.component.ts @@ -5,11 +5,7 @@ import { Input, Output, } from '@angular/core' -import { - DatasetRecord, - UpdateFrequencyCode, - UpdateFrequencyCustom, -} from '@geonetwork-ui/common/domain/record' +import { DatasetRecord } from '@geonetwork-ui/common/domain/record' @Component({ selector: 'gn-ui-metadata-info', @@ -43,20 +39,11 @@ export class MetadataInfoComponent { } get updateFrequency(): string { - if ( - (this.metadata.updateFrequency as UpdateFrequencyCustom).updatedTimes !== - undefined - ) { - this.updatedTimes = ( - this.metadata.updateFrequency as UpdateFrequencyCustom - ).updatedTimes - return `domain.record.updateFrequency.${ - (this.metadata.updateFrequency as UpdateFrequencyCustom).per - }` + if (this.metadata.updateFrequency instanceof Object) { + this.updatedTimes = this.metadata.updateFrequency.updatedTimes + return `domain.record.updateFrequency.${this.metadata.updateFrequency.per}` } else { - return `domain.record.updateFrequency.${ - this.metadata.updateFrequency as UpdateFrequencyCode - }` + return `domain.record.updateFrequency.${this.metadata.updateFrequency}` } }