Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 14 additions & 32 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2026-03-23T09:34:56.311Z\n"
"PO-Revision-Date: 2026-03-23T09:34:56.312Z\n"
"POT-Creation-Date: 2026-05-28T08:40:06.387Z\n"
"PO-Revision-Date: 2026-05-28T08:40:06.388Z\n"

msgid "view only"
msgstr "view only"
Expand Down Expand Up @@ -38,11 +38,6 @@ msgstr "Created {{time}} by {{author}}"
msgid "Created {{time}}"
msgstr "Created {{time}}"

msgid "Viewed {{count}} times"
msgid_plural "Viewed {{count}} times"
msgstr[0] "Viewed 1 time"
msgstr[1] "Viewed {{count}} times"

msgid "Notifications"
msgstr "Notifications"

Expand Down Expand Up @@ -587,11 +582,6 @@ msgstr "Could not load interpretations"
msgid "Reply"
msgstr "Reply"

msgid "{{count}} replies"
msgid_plural "{{count}} replies"
msgstr[0] "{{count}} reply"
msgstr[1] "{{count}} replies"

msgid "View replies"
msgstr "View replies"

Expand Down Expand Up @@ -771,21 +761,6 @@ msgstr "New line list"
msgid "Hide"
msgstr "Hide"

msgid "{{count}} org units"
msgid_plural "{{count}} org units"
msgstr[0] "{{count}} org unit"
msgstr[1] "{{count}} org units"

msgid "{{count}} levels"
msgid_plural "{{count}} levels"
msgstr[0] "{{count}} level"
msgstr[1] "{{count}} levels"

msgid "{{count}} groups"
msgid_plural "{{count}} groups"
msgstr[0] "{{count}} group"
msgstr[1] "{{count}} groups"

msgid "Selected: {{commaSeparatedListOfOrganisationUnits}}"
msgstr "Selected: {{commaSeparatedListOfOrganisationUnits}}"

Expand Down Expand Up @@ -1336,6 +1311,18 @@ msgstr "Assigned Categories"
msgid "No value"
msgstr "No value"

msgid "Active"
msgstr "Active"

msgid "Completed"
msgstr "Completed"

msgid "Scheduled"
msgstr "Scheduled"

msgid "Cancelled"
msgstr "Cancelled"

msgid "Text"
msgstr "Text"

Expand Down Expand Up @@ -1492,10 +1479,5 @@ msgstr "Base"
msgid "Axis {{axisId}}"
msgstr "Axis {{axisId}}"

msgid "{{count}} items"
msgid_plural "{{count}} items"
msgstr[0] "{{count}} item"
msgstr[1] "{{count}} items"

msgid "Reset zoom"
msgstr "Reset zoom"
49 changes: 49 additions & 0 deletions src/modules/response/event/__tests__/default.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,55 @@ describe('default', () => {
},
})
})

it('resolves names from the items map when value matches an item id', () => {
const items = {
C6nZpLKjEJr: {
name: 'African Medical and Research Foundation',
},
CW81uF03hvV: { name: 'AIDSRelief Consortium' },
}
expect(
getItems(
['C6nZpLKjEJr', 'CW81uF03hvV'],
'kO3z4Dhc038.LFsZ8v5v7rq',
{ items }
)
).toEqual({
[`kO3z4Dhc038.LFsZ8v5v7rq${PREFIX_SEPARATOR}C6nZpLKjEJr`]: {
name: 'African Medical and Research Foundation',
},
[`kO3z4Dhc038.LFsZ8v5v7rq${PREFIX_SEPARATOR}CW81uF03hvV`]: {
name: 'AIDSRelief Consortium',
},
})
})

it('falls back to the raw value when no matching item exists (free text)', () => {
const items = {
jfuXZB3A1ko: { name: 'Stage 1 - Repeatable' },
}
expect(
getItems(['email@address.com'], 'jfuXZB3A1ko.RUZ2EBP6HQn', {
items,
})
).toEqual({
[`jfuXZB3A1ko.RUZ2EBP6HQn${PREFIX_SEPARATOR}email@address.com`]:
{ name: 'email@address.com' },
})
})

it('prefers the formatter over the items lookup when both are provided', () => {
const items = { 1: { name: 'should not be used' } }
expect(
getItems(['1'], 'foo', {
items,
itemFormatter: () => 'Yes',
})
).toEqual({
[`foo${PREFIX_SEPARATOR}1`]: { name: 'Yes' },
})
})
})

describe('getDimensions', () => {
Expand Down
47 changes: 47 additions & 0 deletions src/modules/response/event/__tests__/response.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,5 +224,52 @@ describe('response', () => {
).toEqual(responseEventstatusHideNa)
})
})

describe('category (non-optionset id column)', () => {
// Regression: a meta column whose cell values are ids (e.g. a
// CATEGORY data element) that are already named in metaData.items
// must surface those names, not the raw ids.
const headerName = 'kO3z4Dhc038.LFsZ8v5v7rq'
const response = {
headers: [
{
name: headerName,
column: 'Implementing Partner',
valueType: 'TEXT',
type: 'java.lang.String',
hidden: false,
meta: true,
},
],
metaData: {
items: {
C6nZpLKjEJr: {
name: 'African Medical and Research Foundation',
},
CW81uF03hvV: { name: 'AIDSRelief Consortium' },
[headerName]: { name: 'Implementing Partner' },
},
dimensions: {
[headerName]: ['C6nZpLKjEJr', 'CW81uF03hvV'],
},
},
rows: [['C6nZpLKjEJr'], ['CW81uF03hvV']],
}

it('resolves row-value ids to their metaData.items names', () => {
const result = transformResponse(response)

expect(
result.metaData.items[`${headerName}_C6nZpLKjEJr`]
).toEqual({
name: 'African Medical and Research Foundation',
})
expect(
result.metaData.items[`${headerName}_CW81uF03hvV`]
).toEqual({
name: 'AIDSRelief Consortium',
})
})
})
})
})
21 changes: 16 additions & 5 deletions src/modules/response/event/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,22 @@ export const getValuesUniqueSortedAsc = (values, valueType = VALUE_TYPE_TEXT) =>
export const getPrefixedValue = (value, prefix) =>
`${prefix}${PREFIX_SEPARATOR}${value}`

export const getItems = (values, dimensionId, { itemFormatter } = {}) =>
values.reduce((items, value) => {
items[getPrefixedValue(value, dimensionId)] = {
name: itemFormatter ? itemFormatter(value) : value,
const resolveName = (value, itemFormatter, items) => {
if (itemFormatter) {
return itemFormatter(value)
}
/* Assume the value could be an ID, which means the name should
* be looked up in `metaData.items`. If that lookup fails the
* value is used directly. */
return items?.[value]?.name ?? value
}

export const getItems = (values, dimensionId, { itemFormatter, items } = {}) =>
values.reduce((acc, value) => {
acc[getPrefixedValue(value, dimensionId)] = {
name: resolveName(value, itemFormatter, items),
}
return items
return acc
}, {})

export const getDimensions = (values, dimensionId) => ({
Expand Down Expand Up @@ -70,6 +80,7 @@ export const applyDefaultHandler = (
...response.metaData.items,
...getItems(uniqueSortedValuesAsc, header.name, {
itemFormatter,
items: response.metaData.items,
}),
},
dimensions: {
Expand Down
Loading