diff --git a/src/fragmentarium/domain/archaeology.ts b/src/fragmentarium/domain/archaeology.ts index d7a26861e..5ff3e2dee 100644 --- a/src/fragmentarium/domain/archaeology.ts +++ b/src/fragmentarium/domain/archaeology.ts @@ -90,25 +90,37 @@ export class Findspot { return join([range, this.date?.notes], ', ') } - toString(): string { + private get premises(): string { const buildingType = _.capitalize(this.buildingType || '').replaceAll( '_', ' ' ) - const prefix = join([ + return join([ padRight(this.area, ' >'), this.building, parenthesize(buildingType), ]) + } + + private get primaryContextString(): string { + switch (this.primaryContext) { + case true: + return 'primary context' + case false: + return 'secondary context' + case null: + return '' + } + } + + toString(): string { const layer = join([this.levelLayerPhase, parenthesize(this.dateString())]) - const primaryContext = this.primaryContext - ? 'primary context' - : _.isNull(this.primaryContext) - ? '' - : 'secondary context' - const context = join([this.context, parenthesize(primaryContext)]) + const context = join([ + this.context, + parenthesize(this.primaryContextString), + ]) - const parts = join([prefix, layer, this.room, context], ', ') + const parts = join([this.premises, layer, this.room, context], ', ') return padRight(join([parts, _.trimEnd(this.notes, '. ')], '. '), '.') }