Skip to content
Snippets Groups Projects
Commit 320f7eaf authored by Fernando Gbur dos Santos's avatar Fernando Gbur dos Santos
Browse files

[hotfix] Removing some console.log() and fixing 'population out of school'...

[hotfix] Removing some console.log() and fixing 'population out of school' results to 1 decimal place
parent 3d4965b9
No related branches found
No related tags found
3 merge requests!501[hotfix] capital filter working for superior education conclusion tax...,!499[hotfix] capital filter working for superior education conclusion tax...,!497[hotfix] Removing some console.log() and fixing 'population out of school'...
...@@ -405,7 +405,6 @@ CourseAggregateApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => { ...@@ -405,7 +405,6 @@ CourseAggregateApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
.where('curso_superior_agregado.tp_nivel_acad = 1 AND qtd_cursos = 1') .where('curso_superior_agregado.tp_nivel_acad = 1 AND qtd_cursos = 1')
.group('curso_superior_agregado.ano_censo') .group('curso_superior_agregado.ano_censo')
.order('curso_superior_agregado.ano_censo') .order('curso_superior_agregado.ano_censo')
console.log(req.sql.toString())
next(); next();
}, query, id2str.transform(false), response('course_aggregate')); }, query, id2str.transform(false), response('course_aggregate'));
......
...@@ -19,6 +19,7 @@ along with simcaq-node. If not, see <https://www.gnu.org/licenses/>. ...@@ -19,6 +19,7 @@ along with simcaq-node. If not, see <https://www.gnu.org/licenses/>.
*/ */
const express = require('express'); const express = require('express');
const { result } = require('lodash'); const { result } = require('lodash');
const enrollmentAggregateApp = express.Router(); const enrollmentAggregateApp = express.Router();
......
...@@ -445,14 +445,12 @@ function matchQueries(queryPartial, queryTotal) { ...@@ -445,14 +445,12 @@ function matchQueries(queryPartial, queryTotal) {
if(objMatch) { if(objMatch) {
newObj.denominator = result.total; newObj.denominator = result.total;
newObj.pop_total = objMatch.total; newObj.pop_total = objMatch.total;
newObj.total = Math.round((objMatch.total / result.total) * 10000) / 100; newObj.total = parseFloat(((objMatch.total / result.total) * 100).toFixed(1));
match.push(newObj); match.push(newObj);
} }
} }
) )
console.log(match)
return match; return match;
} }
...@@ -477,7 +475,6 @@ PopulationOutOfSchoolApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => ...@@ -477,7 +475,6 @@ PopulationOutOfSchoolApp.get('/', rqf.parse(), rqf.build(), (req, res, next) =>
.order('pnad_novo.ano_ref') .order('pnad_novo.ano_ref')
.order('pnad_novo.faixa_etaria_pop_out') .order('pnad_novo.faixa_etaria_pop_out')
req.querySet.push(attends_school); req.querySet.push(attends_school);
console.log(attends_school.toString());
// Then, the second object is created and stores the sum of all people without filters // Then, the second object is created and stores the sum of all people without filters
...@@ -501,7 +498,6 @@ PopulationOutOfSchoolApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => ...@@ -501,7 +498,6 @@ PopulationOutOfSchoolApp.get('/', rqf.parse(), rqf.build(), (req, res, next) =>
// below is used // below is used
let newObj = matchQueries(req.result[0], req.result[1]); let newObj = matchQueries(req.result[0], req.result[1]);
req.result = newObj; req.result = newObj;
//console.log(attends_school.toString());
} else { } else {
res.status(400); res.status(400);
next({ next({
......
...@@ -257,8 +257,6 @@ function matchQueries(queryTotal, queryPartial) { ...@@ -257,8 +257,6 @@ function matchQueries(queryTotal, queryPartial) {
keys.forEach((key) => { keys.forEach((key) => {
newObj[key] = result[key]; newObj[key] = result[key];
}); });
// console.log('NEW OBJ');
// console.log(newObj);
let index = keys.indexOf('total'); let index = keys.indexOf('total');
if(index > -1) keys.splice(index, 1); if(index > -1) keys.splice(index, 1);
let objMatch = null; let objMatch = null;
...@@ -280,7 +278,6 @@ function matchQueries(queryTotal, queryPartial) { ...@@ -280,7 +278,6 @@ function matchQueries(queryTotal, queryPartial) {
} }
if(objMatch) { if(objMatch) {
// console.log(objMatch);
newObj.denominator = result.total; newObj.denominator = result.total;
newObj.partial = objMatch.total; newObj.partial = objMatch.total;
newObj.total = (objMatch.total / result.total) * 100; newObj.total = (objMatch.total / result.total) * 100;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment