Skip to content
Snippets Groups Projects
Commit 95c251ef authored by lgtg20's avatar lgtg20
Browse files

Apparently working

parent 06b9f3d3
No related branches found
No related tags found
3 merge requests!417[ADD] Indicator "Taxa de Atendimento Educacional" updated on production!,!416[ADD] Route almost ready, some tests needed. Comments added and filters that...,!410Aggregate enrollment
const id2str = require(`./id2str`);
const convert = {
"adm_dependency_detailed": "admDependencyPriv"
}
function aggregateData(req, res, next) {
const newResult = []
const aggregateFields = ['gender']
......@@ -14,7 +18,7 @@ function aggregateData(req, res, next) {
id = 1;
for (const property in r) {
if (property.includes("total_")) {
const data = {
let data = {
total: r[property],
year: r.year,
[`${currentAggregateField}_id`]: id,
......@@ -23,8 +27,7 @@ function aggregateData(req, res, next) {
if (currentNonAggregateField) {
data[`${currentNonAggregateField}_id`] = r[`${currentNonAggregateField}_id`];
console.log(currentNonAggregateField)
data[`${currentNonAggregateField}_name`] = id2str[`${currentNonAggregateField}_id`](id);
data[`${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