Skip to content

Commit

Permalink
fix: include more dimensions in the custom header handling
Browse files Browse the repository at this point in the history
  • Loading branch information
martinkrulltott committed Apr 16, 2024
1 parent ada8821 commit 8b6e401
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions src/components/Visualization/useAnalyticsData.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ import {
import { useDataEngine } from '@dhis2/app-runtime'
import { useEffect, useState, useRef, useCallback } from 'react'
import { getBooleanValues, NULL_VALUE } from '../../modules/conditions.js'
import { DIMENSION_ID_PROGRAM_STATUS } from '../../modules/dimensionConstants.js'
import {
DIMENSION_ID_CREATED,
DIMENSION_ID_CREATED_BY,
DIMENSION_ID_EVENT_STATUS,
DIMENSION_ID_LAST_UPDATED,
DIMENSION_ID_LAST_UPDATED_BY,
DIMENSION_ID_PROGRAM_STATUS,
} from '../../modules/dimensionConstants.js'
import {
extractDimensionIdParts,
formatDimensionId,
Expand Down Expand Up @@ -194,6 +201,11 @@ const extractHeaders = (analyticsResponse, outputType) => {
dimensionId: [
DIMENSION_ID_ORGUNIT,
DIMENSION_ID_PROGRAM_STATUS,
DIMENSION_ID_EVENT_STATUS,
DIMENSION_ID_CREATED_BY,
DIMENSION_ID_LAST_UPDATED_BY,
DIMENSION_ID_LAST_UPDATED,
DIMENSION_ID_CREATED,
].includes(idMatch)
? idMatch
: dimensionId,
Expand All @@ -203,10 +215,11 @@ const extractHeaders = (analyticsResponse, outputType) => {
})

if (
programId &&
[DIMENSION_ID_ORGUNIT, DIMENSION_ID_PROGRAM_STATUS].includes(
idMatch
)
[
DIMENSION_ID_ORGUNIT,
DIMENSION_ID_PROGRAM_STATUS,
DIMENSION_ID_EVENT_STATUS,
].includes(idMatch)
) {
defaultMetadata[formattedDimensionId] =
getProgramDimensions(programId)[formattedDimensionId]
Expand Down Expand Up @@ -245,6 +258,11 @@ const extractHeaders = (analyticsResponse, outputType) => {
dimensionId: [
DIMENSION_ID_ORGUNIT,
DIMENSION_ID_PROGRAM_STATUS,
DIMENSION_ID_EVENT_STATUS,
DIMENSION_ID_CREATED_BY,
DIMENSION_ID_LAST_UPDATED_BY,
DIMENSION_ID_LAST_UPDATED,
DIMENSION_ID_CREATED,
].includes(idMatch)
? idMatch
: dimensionId,
Expand Down

0 comments on commit 8b6e401

Please sign in to comment.