Skip to content
Snippets Groups Projects
Commit 089976d8 authored by lgtg20's avatar lgtg20
Browse files

Merge branch 'fix-school-dimension-enrollment-aggregate' into 'development'

fix: update aggregateData middleware to handle base fields correctly

See merge request !447
parents f41ff9cc 86bc6984
No related branches found
No related tags found
3 merge requests!449Homologa,!448Development,!447fix: update aggregateData middleware to handle base fields correctly
......@@ -67,10 +67,10 @@ function aggregateData(req, res, next) {
'education_degree_entity',
'receitas',
'despesas'
]
];
const baseFields = ["school"]
let id;
const fields = req.query.dims.split(',');
console.log(fields);
let currentAggregateField;
let currentNonAggregateField;
......@@ -92,7 +92,9 @@ function aggregateData(req, res, next) {
if (currentNonAggregateField) {
data[`${currentNonAggregateField}_id`] = r[`${currentNonAggregateField}_id`];
data[`${currentNonAggregateField}_name`] = id2str[convert[currentNonAggregateField]](r[`${currentNonAggregateField}_id`]);
data[`${currentNonAggregateField}_name`] = baseFields.includes(currentNonAggregateField)
? r[`${currentNonAggregateField}_name`]
: id2str[convert[currentNonAggregateField]](r[`${currentNonAggregateField}_id`]);
}
newResult.push(data)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment