Skip to content
Snippets Groups Projects
Commit 892a5cf7 authored by ems19's avatar ems19
Browse files

adds year filter

parent 24dcfc9f
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
......@@ -142,6 +142,26 @@ rqf.addField({
foreign: 'municipio_id',
foreignTable: 'escola'
}
}).addValue({
name: 'min_year',
table: 'escola',
tableField: 'ano_censo',
resultField: 'year',
where: {
relation: '>=',
type: 'integer',
field: 'ano_censo',
},
}).addValue({
name: 'max_year',
table: 'escola',
tableField: 'ano_censo',
resultField: 'year',
where: {
relation: '<=',
type: 'integer',
field: 'ano_censo',
},
}).addValueToField({
name: 'state',
table: 'estado',
......@@ -273,6 +293,9 @@ rqf.addField({
enrollmentAggregateApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
req.sql.from('escola')
.field('SUM(escola.qt_mat_bas)', 'total')
.field('escola.ano_censo', 'year')
.group('escola.ano_censo')
.order('escola.ano_censo');
next();
}, query, response('enrollment_aggregate'));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment