Skip to content

Commit

Permalink
Add Sector to Display
Browse files Browse the repository at this point in the history
  • Loading branch information
ejimsan committed Dec 14, 2024
1 parent dc2e89b commit 6a259dc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/fragmentarium/domain/archaeology.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const findspot = findspotFactory.build({
const findspotDto: FindspotDto = {
..._.pick(
findspot,
'sector',
'area',
'building',
'buildingType',
Expand All @@ -67,6 +68,7 @@ const findspotDto: FindspotDto = {
plans: [planDto],
}
const defaultParams: Partial<Findspot> = {
sector: '',
area: '',
building: 'a house',
buildingType: 'RESIDENTIAL' as BuildingType,
Expand Down Expand Up @@ -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',
],
Expand All @@ -155,7 +158,7 @@ test.each([
],
[
'without area or notes',
{ area: '' },
{ sector: '', area: '' },
'a house (Residential), II (1200 BCE - 1150 BCE).',
'en-US',
],
Expand Down
3 changes: 2 additions & 1 deletion src/fragmentarium/domain/archaeology.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -133,7 +134,7 @@ export class Findspot {
' '
)
return join([
join([this.area, this.building], ' > '),
join([this.sector, this.area, this.building], ' > '),
parenthesize(buildingType),
])
}
Expand Down
2 changes: 2 additions & 0 deletions src/fragmentarium/domain/archaeologyDtos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ interface PlanDto {

export type FindspotDto = Pick<
Findspot,
| 'sector'
| 'area'
| 'building'
| 'buildingType'
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions src/test-support/fragment-data-fixtures.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ export const findspotFactory = Factory.define<Findspot>(
chance.pickone(Object.values(excavationSites)),
chance.word(),
chance.word(),
chance.word(),
chance.pickone(['RESIDENTIAL', 'TEMPLE', 'UNKNOWN']),
chance.pickone(['I', 'II', undefined]),
dateRangeFactory.build(),
Expand Down

0 comments on commit 6a259dc

Please sign in to comment.