-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
4364 - Table 1a: Forest area - Previously reported - validator -> lat…
…est - 2025 (#4371) * 4364 - meta/Cycle: assessmentId, optional dateEditing and datePublished * 4364 - add support for $prevCycle * 4364 - validatorEqualToPreviousCycleForestArea rename params * 4364 - Cycles.getPreviousCycle * 4364 - unit test full path * 4364 - no-param-reassign: ignorePropertyModificationsFor acc * 4364 - generateMetaCache: Update context type arrayAssessments -> recordAssessments * 4364 - Assessments util: getRecordAssessments * 4364 - util getCycleName * 4364 - clean up * 4364 - migration step * 4364 - introduce base context * 4364 - generateMetaCache * 4364 - Member * 4364 - create recordAssessments outside loop
- Loading branch information
Showing
16 changed files
with
247 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
import { Assessment } from './assessment' | ||
import { Cycle, CycleStatus } from './cycle' | ||
|
||
const isPublished = (cycle: Cycle): boolean => { | ||
return cycle.props.status === CycleStatus.published | ||
} | ||
|
||
const getPreviousCycle = (props: { assessment: Assessment; cycle: Cycle }): Cycle | undefined => { | ||
const { assessment, cycle } = props | ||
return assessment.cycles.find((c) => c.uuid === cycle.cycleUuidSource) | ||
} | ||
|
||
export const Cycles = { | ||
isPublished, | ||
getPreviousCycle, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { Assessment, AssessmentNames, CycleStatus, RecordAssessments } from '../assessment' | ||
import { Context } from './context' | ||
|
||
const assessment = { | ||
cycles: [ | ||
{ | ||
id: 1, | ||
name: '2020', | ||
uuid: '66817a08-dc93-4151-b5ed-176d8f04e9b7', | ||
props: { | ||
status: CycleStatus.published, | ||
dateDraft: '2017-01-01T00:00:00.000Z', | ||
dateCreated: '2018-01-01T00:00:00.000Z', | ||
dateEditing: '2018-03-05T00:00:00.000Z', | ||
datePublished: '2020-07-21T00:00:00.000Z', | ||
}, | ||
assessmentId: 1, | ||
cycleUuidSource: null, | ||
}, | ||
{ | ||
id: 2, | ||
name: '2025', | ||
uuid: '66da2217-da42-492f-9ff4-c99a59e6675c', | ||
props: { | ||
status: CycleStatus.editing, | ||
dateDraft: '2021-01-01T00:00:00.000Z', | ||
dateCreated: '2022-01-01T00:00:00.000Z', | ||
dateEditing: '2022-03-02T00:00:00.000Z', | ||
}, | ||
assessmentId: 1, | ||
cycleUuidSource: '66817a08-dc93-4151-b5ed-176d8f04e9b7', | ||
}, | ||
{ | ||
id: 39, | ||
name: 'latest', | ||
uuid: '9fa1fd86-b4e3-46e4-bf48-125f082ea501', | ||
props: { | ||
status: CycleStatus.draft, | ||
dateDraft: '2025-02-11T21:20:08.602Z', | ||
dateCreated: '2025-02-11T21:20:08.602Z', | ||
}, | ||
assessmentId: 1, | ||
cycleUuidSource: '66da2217-da42-492f-9ff4-c99a59e6675c', | ||
}, | ||
], | ||
props: { | ||
name: AssessmentNames.fra, | ||
}, | ||
} as Assessment | ||
|
||
const assessments: RecordAssessments = { | ||
[AssessmentNames.fra]: assessment, | ||
} | ||
|
||
export const contextMock: Context = { | ||
assessments, | ||
assessment, | ||
cycle: { | ||
id: 2, | ||
name: '2025', | ||
uuid: '66da2217-da42-492f-9ff4-c99a59e6675c', | ||
props: { | ||
status: CycleStatus.editing, | ||
dateDraft: '2021-01-01T00:00:00.000Z', | ||
dateCreated: '2022-01-01T00:00:00.000Z', | ||
dateEditing: '2022-03-02T00:00:00.000Z', | ||
}, | ||
assessmentId: 1, | ||
cycleUuidSource: '66817a08-dc93-4151-b5ed-176d8f04e9b7', | ||
}, | ||
} as Context |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { AssessmentName, CycleName, RecordAssessments } from 'meta/assessment' | ||
|
||
export type BaseContext = { assessments: RecordAssessments; assessmentName: AssessmentName; cycleName: CycleName } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { Member } from './member' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export enum Member { | ||
'$prevCycle' = '$prevCycle', | ||
} |
Oops, something went wrong.