Skip to content
Snippets Groups Projects

Development

Merged lgtg20 requested to merge development into homologa
1 file
+ 5
3
Compare changes
  • Side-by-side
  • Inline
@@ -36,7 +36,8 @@ const convert = {
total_doc: "totalDoc",
education_degree_entity: "educationDegreeEntity",
government_agreement: "governmentAgreement",
receitas: "revenue"
receitas: "revenue",
despesas: "studentCost"
}
function aggregateData(req, res, next) {
@@ -64,8 +65,10 @@ function aggregateData(req, res, next) {
'post_graduation_entity',
'contract_type_entity',
'education_degree_entity',
'receitas'
]
'receitas',
'despesas'
];
const baseFields = ["school"]
let id;
const fields = req.query.dims.split(',');
let currentAggregateField;
@@ -89,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)
Loading