Skip to content

Commit

Permalink
Revert "rename dateRange field"
Browse files Browse the repository at this point in the history
This reverts commit 30674c2.
  • Loading branch information
fsimonjetz committed Feb 2, 2024
1 parent 30674c2 commit f8a86b6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
11 changes: 6 additions & 5 deletions src/fragmentarium/domain/archaeology.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ const planDto = {
references: [referenceDto],
}
const plan = { svg: '<svg></svg>', references: [reference] }
const dateRange = dateRangeFactory.build()
const findspot = findspotFactory.build({
site: excavationSites[site],
date: dateRangeFactory.build(),
dateRange: dateRange,
plans: [plan],
})
const findspotDto: FindspotDto = {
Expand All @@ -58,7 +59,7 @@ const findspotDto: FindspotDto = {
'context',
'primaryContext',
'notes',
'date'
'dateRange'
),
_id: findspot.id,
site: site,
Expand All @@ -69,7 +70,7 @@ const displayParams: Partial<Findspot> = {
building: 'a house',
buildingType: 'RESIDENTIAL' as BuildingType,
levelLayerPhase: 'II',
date: {
dateRange: {
start: -1200,
end: -1150,
notes: '',
Expand Down Expand Up @@ -140,14 +141,14 @@ test.each([
],
[
'no levelLayerPhase and date',
{ ...displayParams, levelLayerPhase: '', date: null },
{ ...displayParams, levelLayerPhase: '', dateRange: null },
'a house (Residential).',
],
[
'with date notes',
{
...displayParams,
date: { ...displayParams.date, notes: 'date notes' },
dateRange: { ...displayParams.dateRange, notes: 'date notes' },
},
'a house (Residential), II (1200 BCE - 1150 BCE, date notes).',
],
Expand Down
14 changes: 7 additions & 7 deletions src/fragmentarium/domain/archaeology.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class Findspot {
readonly building: string = '',
readonly buildingType: BuildingType | null = null,
readonly levelLayerPhase: string = '',
readonly date: CommentedDateRange | null = null,
readonly dateRange: CommentedDateRange | null = null,
readonly plans: readonly ExcavationPlan[] = [],
readonly room: string = '',
readonly context: string = '',
Expand All @@ -72,9 +72,9 @@ export class Findspot {
) {}

private dateString(): string {
const start = makeDate(this.date?.start)
const end = makeDate(this.date?.end)
const notes = padLeft(this.date?.notes, ', ')
const start = makeDate(this.dateRange?.start)
const end = makeDate(this.dateRange?.end)
const notes = padLeft(this.dateRange?.notes, ', ')

return end ? ` (${start} - ${end}${notes})` : start ? ` (${start})` : ''
}
Expand Down Expand Up @@ -122,7 +122,7 @@ export type FindspotDto = Pick<
> & {
_id: number
site: SiteKey
date: CommentedDateRangeDto | null
dateRange: CommentedDateRangeDto | null
plans: readonly PlanDto[]
}

Expand Down Expand Up @@ -155,7 +155,7 @@ export function fromFindspotDto(dto: FindspotDto): Findspot {
dto.building,
dto.buildingType,
dto.levelLayerPhase,
dto.date,
dto.dateRange,
dto.plans.map(fromPlanDto),
dto.room,
dto.context,
Expand All @@ -176,7 +176,7 @@ export function toFindspotDto(findspot: Findspot): FindspotDto {
primaryContext: findspot.primaryContext,
notes: findspot.notes,
site: findspot.site.name as SiteKey,
date: findspot.date,
dateRange: findspot.dateRange,
plans: findspot.plans.map(toPlanDto),
}
}
Expand Down

0 comments on commit f8a86b6

Please sign in to comment.