From 6a259dc798d23d439b17ab8f82dffded6f3aa07c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Jim=C3=A9nez?= Date: Sat, 14 Dec 2024 23:47:35 +0000 Subject: [PATCH] Add Sector to Display --- src/fragmentarium/domain/archaeology.test.ts | 7 +++++-- src/fragmentarium/domain/archaeology.ts | 3 ++- src/fragmentarium/domain/archaeologyDtos.ts | 2 ++ src/test-support/fragment-data-fixtures.tsx | 1 + 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/fragmentarium/domain/archaeology.test.ts b/src/fragmentarium/domain/archaeology.test.ts index 920f33103..ac3aa4e5d 100644 --- a/src/fragmentarium/domain/archaeology.test.ts +++ b/src/fragmentarium/domain/archaeology.test.ts @@ -52,6 +52,7 @@ const findspot = findspotFactory.build({ const findspotDto: FindspotDto = { ..._.pick( findspot, + 'sector', 'area', 'building', 'buildingType', @@ -67,6 +68,7 @@ const findspotDto: FindspotDto = { plans: [planDto], } const defaultParams: Partial = { + sector: '', area: '', building: 'a house', buildingType: 'RESIDENTIAL' as BuildingType, @@ -127,13 +129,14 @@ test.each([ [ 'with full info', { + sector: 'some sector', area: 'some area', room: 'Room 42', context: 'On the floor', primaryContext: true, notes: 'General notes.', }, - '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', ], @@ -155,7 +158,7 @@ test.each([ ], [ 'without area or notes', - { area: '' }, + { sector: '', area: '' }, 'a house (Residential), II (1200 BCE - 1150 BCE).', 'en-US', ], diff --git a/src/fragmentarium/domain/archaeology.ts b/src/fragmentarium/domain/archaeology.ts index 42ab99a50..74186328f 100644 --- a/src/fragmentarium/domain/archaeology.ts +++ b/src/fragmentarium/domain/archaeology.ts @@ -107,6 +107,7 @@ export class Findspot { constructor( readonly id: number, readonly site: ExcavationSite = excavationSites[''], + readonly sector: string = '', readonly area: string = '', readonly building: string = '', readonly buildingType: BuildingType | null = null, @@ -133,7 +134,7 @@ export class Findspot { ' ' ) return join([ - join([this.area, this.building], ' > '), + join([this.sector, this.area, this.building], ' > '), parenthesize(buildingType), ]) } diff --git a/src/fragmentarium/domain/archaeologyDtos.ts b/src/fragmentarium/domain/archaeologyDtos.ts index 6f54f6f90..6a63f5739 100644 --- a/src/fragmentarium/domain/archaeologyDtos.ts +++ b/src/fragmentarium/domain/archaeologyDtos.ts @@ -47,6 +47,7 @@ interface PlanDto { export type FindspotDto = Pick< Findspot, + | 'sector' | 'area' | 'building' | 'buildingType' @@ -98,6 +99,7 @@ export function fromFindspotDto(dto: FindspotDto): Findspot { return new Findspot( dto._id, excavationSites[dto.site || ''], + dto.sector, dto.area, dto.building, dto.buildingType, diff --git a/src/test-support/fragment-data-fixtures.tsx b/src/test-support/fragment-data-fixtures.tsx index 81e1a0b2f..f26f74649 100644 --- a/src/test-support/fragment-data-fixtures.tsx +++ b/src/test-support/fragment-data-fixtures.tsx @@ -220,6 +220,7 @@ export const findspotFactory = Factory.define( chance.pickone(Object.values(excavationSites)), chance.word(), chance.word(), + chance.word(), chance.pickone(['RESIDENTIAL', 'TEMPLE', 'UNKNOWN']), chance.pickone(['I', 'II', undefined]), dateRangeFactory.build(),