diff --git a/i18n/en.pot b/i18n/en.pot index d46ae676..7f1bb1d8 100644 --- a/i18n/en.pot +++ b/i18n/en.pot @@ -549,14 +549,14 @@ msgstr "Data elements" msgid "Organisation unit groups" msgstr "Organisation unit groups" -msgid "Tracked entity instances" -msgstr "Tracked entity instances" +msgid "Tracked entities" +msgstr "Tracked entities" msgid "Pivot tables" msgstr "Pivot tables" -msgid "Program instances" -msgstr "Program instances" +msgid "Enrollments" +msgstr "Enrollments" msgid "Indicator types" msgstr "Indicator types" diff --git a/src/pages/data-statistics/parse-tables.js b/src/pages/data-statistics/parse-tables.js index 858b7414..2357197c 100644 --- a/src/pages/data-statistics/parse-tables.js +++ b/src/pages/data-statistics/parse-tables.js @@ -13,16 +13,16 @@ const objectLabels = { indicator: i18n.t('Indicators'), period: i18n.t('Periods'), visualization: i18n.t('Visualization'), - programStageInstance: i18n.t('Events'), + event: 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'), - trackedEntityInstance: i18n.t('Tracked entity instances'), + trackedEntity: i18n.t('Tracked entities'), reportTable: i18n.t('Pivot tables'), - programInstance: i18n.t('Program instances'), + enrollment: i18n.t('Enrollments'), indicatorType: i18n.t('Indicator types'), dataSet: i18n.t('Data sets'), userGroup: i18n.t('User groups'), @@ -48,17 +48,25 @@ const translatedTimeLabelFromIntProperty = (key) => { } } +// old (<=v40) keys +const excludedObjectCountKeys = [ + 'programInstance', + 'programStageInstance', + 'trackedEntityInstance', +] + const objectCountsTableFromResponse = (objectCountsResponse) => { if (!objectCountsResponse) { return null } - const elements = Object.entries(objectCountsResponse).map( - ([key, count]) => ({ + // 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]) => ({ label: objectLabels[key] || key, count, - }) - ) + })) elements.sort((a, b) => a.label.localeCompare(b.label)) return {