Skip to content

Commit

Permalink
fix: fetch time dimension metadata from programDimensions
Browse files Browse the repository at this point in the history
  • Loading branch information
martinkrulltott committed Jan 30, 2024
1 parent 81644fe commit c481044
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ import {
visualizationNotFoundError,
} from '../modules/error.js'
import history from '../modules/history.js'
import { getDefaultOuMetadata } from '../modules/metadata.js'
import {
getDefaultOuMetadata,
getDynamicTimeDimensionsMetadata,
} from '../modules/metadata.js'
import { getProgramDimensions } from '../modules/programDimensions.js'
import { SYSTEM_SETTINGS_DIGIT_GROUP_SEPARATOR } from '../modules/systemSettings.js'
import { getParentGraphMapFromVisualization } from '../modules/ui.js'
Expand Down Expand Up @@ -436,6 +439,19 @@ const App = () => {
visualization.programDimensions.forEach((program) => {
programDimensionsMetadata[program.id] = program

const timeDimensions = getDynamicTimeDimensionsMetadata(program)
Object.keys(timeDimensions).forEach((timeDimensionId) => {
const formattedId = formatDimensionId({
dimensionId: timeDimensionId,
programId: program.id,
outputType: visualization.outputType,
})
programDimensionsMetadata[formattedId] = {
...timeDimensions[timeDimensionId],
id: formattedId,
}
})

if (program.programStages) {
program.programStages.forEach((stage) => {
programDimensionsMetadata[stage.id] = stage
Expand All @@ -459,7 +475,9 @@ const App = () => {
addOptionSetsMetadata(visualization)
addTrackedEntityTypeMetadata(visualization)
addFixedDimensionsMetadata(visualization)
addProgramDimensionsMetadata(visualization)
if (visualization.outputType === OUTPUT_TYPE_TRACKED_ENTITY) {
addProgramDimensionsMetadata(visualization)
}

dispatch(
acAddParentGraphMap(
Expand Down

0 comments on commit c481044

Please sign in to comment.