Skip to content

Commit

Permalink
Revert "fix: remove duplicate counts [DHIS2-15948] (#1013) (#1024)" (#…
Browse files Browse the repository at this point in the history
…1025)

This reverts commit 97d4a3b.
  • Loading branch information
tomzemp authored Dec 15, 2023
1 parent 97d4a3b commit 0c2478d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 19 deletions.
8 changes: 4 additions & 4 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -549,14 +549,14 @@ msgstr "Data elements"
msgid "Organisation unit groups"
msgstr "Organisation unit groups"

msgid "Tracked entities"
msgstr "Tracked entities"
msgid "Tracked entity instances"
msgstr "Tracked entity instances"

msgid "Pivot tables"
msgstr "Pivot tables"

msgid "Enrollments"
msgstr "Enrollments"
msgid "Program instances"
msgstr "Program instances"

msgid "Indicator types"
msgstr "Indicator types"
Expand Down
22 changes: 7 additions & 15 deletions src/pages/data-statistics/parse-tables.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ const objectLabels = {
indicator: i18n.t('Indicators'),
period: i18n.t('Periods'),
visualization: i18n.t('Visualization'),
event: i18n.t('Events'),
programStageInstance: i18n.t('Events'),
organisationUnit: i18n.t('Organisation units'),
validationRule: i18n.t('Validation rules'),
dataValue: i18n.t('Data values'),
program: i18n.t('Programs'),
dataElement: i18n.t('Data elements'),
organisationUnitGroup: i18n.t('Organisation unit groups'),
trackedEntity: i18n.t('Tracked entities'),
trackedEntityInstance: i18n.t('Tracked entity instances'),
reportTable: i18n.t('Pivot tables'),
enrollment: i18n.t('Enrollments'),
programInstance: i18n.t('Program instances'),
indicatorType: i18n.t('Indicator types'),
dataSet: i18n.t('Data sets'),
userGroup: i18n.t('User groups'),
Expand All @@ -48,25 +48,17 @@ const translatedTimeLabelFromIntProperty = (key) => {
}
}

// old (<=v40) keys
const excludedObjectCountKeys = [
'programInstance',
'programStageInstance',
'trackedEntityInstance',
]

const objectCountsTableFromResponse = (objectCountsResponse) => {
if (!objectCountsResponse) {
return null
}

// api returns old (<=v40) and new (>=v41) keys; filter out old ones
const elements = Object.entries(objectCountsResponse)
.filter(([key]) => !excludedObjectCountKeys.includes(key))
.map(([key, count]) => ({
const elements = Object.entries(objectCountsResponse).map(
([key, count]) => ({
label: objectLabels[key] || key,
count,
}))
})
)
elements.sort((a, b) => a.label.localeCompare(b.label))

return {
Expand Down

0 comments on commit 0c2478d

Please sign in to comment.