Skip to content
Snippets Groups Projects
Commit 86bc6984 authored by lgtg20's avatar lgtg20
Browse files

fix: update aggregateData middleware to handle base fields correctly

parent f41ff9cc
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) { ...@@ -67,10 +67,10 @@ function aggregateData(req, res, next) {
'education_degree_entity', 'education_degree_entity',
'receitas', 'receitas',
'despesas' 'despesas'
] ];
const baseFields = ["school"]
let id; let id;
const fields = req.query.dims.split(','); const fields = req.query.dims.split(',');
console.log(fields);
let currentAggregateField; let currentAggregateField;
let currentNonAggregateField; let currentNonAggregateField;
...@@ -92,7 +92,9 @@ function aggregateData(req, res, next) { ...@@ -92,7 +92,9 @@ function aggregateData(req, res, next) {
if (currentNonAggregateField) { if (currentNonAggregateField) {
data[`${currentNonAggregateField}_id`] = r[`${currentNonAggregateField}_id`]; 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) 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