From ad6698338c898215e73c2418aa0dab7ad238cb1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Jim=C3=A9nez?= <39047733+ejimsan@users.noreply.github.com> Date: Sun, 15 Dec 2024 19:03:01 +0100 Subject: [PATCH] Add display of sector (#515) * Add Sector to Display * Update archaeology to show partial dates in findspot * Correct duplicated sector --- src/fragmentarium/domain/archaeology.test.ts | 16 ++++++++-------- src/fragmentarium/domain/archaeology.ts | 2 +- src/fragmentarium/domain/archaeologyDtos.ts | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/fragmentarium/domain/archaeology.test.ts b/src/fragmentarium/domain/archaeology.test.ts index ac3aa4e5d..4df9a7e34 100644 --- a/src/fragmentarium/domain/archaeology.test.ts +++ b/src/fragmentarium/domain/archaeology.test.ts @@ -136,7 +136,7 @@ test.each([ primaryContext: true, notes: 'General notes.', }, - 'some sector > some area > a house (Residential), II (1200 BCE - 1150 BCE), ' + + 'some sector > some area > a house (Residential), II (1200 BCE – 1150 BCE), ' + 'Room 42, On the floor (primary context). General notes.', 'de-DE', ], @@ -153,31 +153,31 @@ test.each([ [ 'with area and notes', { area: 'some area', notes: 'General notes.' }, - 'some area > a house (Residential), II (1200 BCE - 1150 BCE). General notes.', + 'some area > a house (Residential), II (1200 BCE – 1150 BCE). General notes.', 'de-DE', ], [ 'without area or notes', - { sector: '', area: '' }, - 'a house (Residential), II (1200 BCE - 1150 BCE).', + { area: '' }, + 'a house (Residential), II (1200 BCE – 1150 BCE).', 'en-US', ], [ 'without notes', { notes: '' }, - 'a house (Residential), II (1200 BCE - 1150 BCE).', + 'a house (Residential), II (1200 BCE – 1150 BCE).', 'en-US', ], [ 'without building', { building: '' }, - '(Residential), II (1200 BCE - 1150 BCE).', + '(Residential), II (1200 BCE – 1150 BCE).', 'de-DE', ], [ 'without buildingType', { buildingType: null }, - 'a house, II (1200 BCE - 1150 BCE).', + 'a house, II (1200 BCE – 1150 BCE).', 'en-US', ], [ @@ -191,7 +191,7 @@ test.each([ { date: { ...defaultParams.date, notes: 'date notes' }, }, - 'a house (Residential), II (1200 BCE - 1150 BCE, date notes).', + 'a house (Residential), II (1200 BCE – 1150 BCE, date notes).', 'en-US', ], [ diff --git a/src/fragmentarium/domain/archaeology.ts b/src/fragmentarium/domain/archaeology.ts index 74186328f..95d8cf64d 100644 --- a/src/fragmentarium/domain/archaeology.ts +++ b/src/fragmentarium/domain/archaeology.ts @@ -123,7 +123,7 @@ export class Findspot { private dateString(): string { const start = this.date?.start.toString() const end = this.date?.end?.toString() - const range = join([start, end], ' - ') + const range = end ? `${start} – ${end}` : start return join([range, this.date?.notes], ', ') } diff --git a/src/fragmentarium/domain/archaeologyDtos.ts b/src/fragmentarium/domain/archaeologyDtos.ts index 6a63f5739..ae7f9359d 100644 --- a/src/fragmentarium/domain/archaeologyDtos.ts +++ b/src/fragmentarium/domain/archaeologyDtos.ts @@ -91,7 +91,7 @@ function fromDateRangeDto(dto: DateRangeDto): DateRange { return { ...dto, start: createPartialDate(dto.start), - end: createPartialDate(dto.end), + end: dto.end ? createPartialDate(dto.end) : null, } }