Skip to content

Commit

Permalink
review(metadata-info): simplify updateFrequency getter
Browse files Browse the repository at this point in the history
  • Loading branch information
tkohr authored and jahow committed Nov 13, 2023
1 parent b911e03 commit ddb0857
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions libs/ui/elements/src/lib/metadata-info/metadata-info.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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}`
}
}

Expand Down

0 comments on commit ddb0857

Please sign in to comment.