-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: prefix time dimension ids with program id when tracked entity o…
…utput type (#480) Implements https://dhis2.atlassian.net/browse/DHIS2-16023 Description Time dimensions need to be prefixed with the programId when using TE output type. * adding time dimensions from different programs to layout - they get suffixed with the program name * analytics query works - correct data is displayed * saving LL with time dimensions saves successfully * opening a saved LL with time dimensions - layout is empty but table shows correctly (metadata issue to be solved with backend changes) The failing cypress tests are the same failures as the target branch
- Loading branch information
1 parent
b5a8c86
commit e0398d0
Showing
7 changed files
with
171 additions
and
40 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import { getDynamicTimeDimensionsMetadata } from '../metadata.js' | ||
|
||
describe('getDynamicTimeDimensionsMetadata', () => { | ||
it('should return correct dynamic time dimensions metadata when inputType is OUTPUT_TYPE_TRACKED_ENTITY', () => { | ||
const program = { | ||
id: 'programId', | ||
displayEnrollmentDateLabel: 'Custom Enrollment Date', | ||
displayIncidentDateLabel: 'Custom Incident Date', | ||
} | ||
const stage = { displayExecutionDateLabel: 'Stage Execution Date' } | ||
const inputType = 'TRACKED_ENTITY_INSTANCE' // OUTPUT_TYPE_TRACKED_ENTITY | ||
|
||
const result = getDynamicTimeDimensionsMetadata( | ||
program, | ||
stage, | ||
inputType | ||
) | ||
|
||
const expected = { | ||
'programId.eventDate': { | ||
id: 'programId.eventDate', | ||
dimensionType: 'PERIOD', | ||
name: 'Stage Execution Date', | ||
}, | ||
'programId.enrollmentDate': { | ||
id: 'programId.enrollmentDate', | ||
dimensionType: 'PERIOD', | ||
name: 'Custom Enrollment Date', | ||
}, | ||
'programId.incidentDate': { | ||
id: 'programId.incidentDate', | ||
dimensionType: 'PERIOD', | ||
name: 'Custom Incident Date', | ||
}, | ||
'programId.scheduledDate': { | ||
id: 'programId.scheduledDate', | ||
dimensionType: 'PERIOD', | ||
name: 'Scheduled date', | ||
}, | ||
} | ||
|
||
expect(result).toEqual(expected) | ||
}) | ||
|
||
it('should return correct dynamic time dimensions metadata when inputType is not OUTPUT_TYPE_TRACKED_ENTITY', () => { | ||
const program = { | ||
id: 'programId', | ||
displayEnrollmentDateLabel: 'Program Enrollment Date', | ||
displayIncidentDateLabel: 'Custom Incident Date', | ||
} | ||
const stage = { displayExecutionDateLabel: 'Stage Execution Date' } | ||
const inputType = 'OTHER_TYPE' | ||
|
||
const result = getDynamicTimeDimensionsMetadata( | ||
program, | ||
stage, | ||
inputType | ||
) | ||
|
||
const expected = { | ||
eventDate: { | ||
id: 'eventDate', | ||
dimensionType: 'PERIOD', | ||
name: 'Stage Execution Date', | ||
}, | ||
enrollmentDate: { | ||
id: 'enrollmentDate', | ||
dimensionType: 'PERIOD', | ||
name: 'Program Enrollment Date', | ||
}, | ||
incidentDate: { | ||
id: 'incidentDate', | ||
dimensionType: 'PERIOD', | ||
name: 'Custom Incident Date', | ||
}, | ||
scheduledDate: { | ||
id: 'scheduledDate', | ||
dimensionType: 'PERIOD', | ||
name: 'Scheduled date', | ||
}, | ||
} | ||
|
||
expect(result).toEqual(expected) | ||
}) | ||
}) |
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