Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Sector to Display #514

Merged
merged 1 commit into from
Dec 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading