Skip to content
Snippets Groups Projects
Commit e0e31efb authored by Fernando Erd's avatar Fernando Erd :ok_hand:
Browse files

Fix error in rate school

parent f25687ae
No related branches found
No related tags found
1 merge request!116Release v1.0.0
Pipeline #
......@@ -26,10 +26,10 @@ const passport = require('passport');
const cache = require('apicache').options({ debug: config.debug, statusCodes: {include: [200]} }).middleware;
let rqf = new ReqQueryFields();
rateSchoolApp.use(cache('15 day'));
let rqf = new ReqQueryFields();
// Complete range of the enrollments dataset.
// Returns a tuple of start and ending years of the complete enrollments dataset.
rateSchoolApp.get('/year_range', (req, res, next) => {
......@@ -151,28 +151,6 @@ rqf.addField({
foreign: 'estado_id',
foreignTable: 'pnad'
}
}).addValue({
name: 'min_year',
table: 'pnad',
tableField: 'ano_censo',
resultField: 'year',
where: {
relation: '>=',
type: 'integer',
table: 'pnad',
field: 'ano_censo'
}
}).addValue({
name: 'max_year',
table: 'pnad',
tableField: 'ano_censo',
resultField: 'year',
where: {
relation: '<=',
type: 'integer',
table: 'pnad',
field: 'ano_censo'
}
}).addValue({
name: 'ethnic_group',
table: 'pnad',
......@@ -264,9 +242,9 @@ function matchQueries(queryTotal, queryPartial) {
}
if(objMatch) {
newObj.total = result.total;
newObj.denominator = result.total;
newObj.partial = objMatch.total;
newObj.percentage = (objMatch.total / result.total) * 100;
newObj.total = (objMatch.total / result.total) * 100;
match.push(newObj);
}
});
......@@ -304,7 +282,7 @@ rateSchoolApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
req.result = school_attendance_rate;
next();
}, id2str.multitransform(false), response('rate_school'));
}, id2str.transform(false), response('rateSchool'));
rateSchoolApp.get('/download', passport.authenticate('bearer', { session: false }), rqf.parse(), rqf.build(), download('pnad', 'mapping_pnad'));
......
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