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

Add filter and fix year_range

parent b229d7fb
No related branches found
No related tags found
3 merge requests!116Release v1.0.0,!44Feature multiple where,!37Route_Class
Pipeline #
......@@ -18,9 +18,9 @@ let rqfCount = new ReqQueryFields();
// Complete range of the enrollments dataset.
// Returns a tuple of start and ending years of the complete enrollments dataset.
classApp.get('/year_range', (req, res, next) => {
req.sql.from('matricula')
.field('MIN(matricula.ano_censo)', 'start_year')
.field('MAX(matricula.ano_censo)', 'end_year');
req.sql.from('turma')
.field('MIN(turma.ano_censo)', 'start_year')
.field('MAX(turma.ano_censo)', 'end_year');
next();
}, query, response('range'));
......@@ -119,6 +119,26 @@ rqfCount.addField({
foreign: 'regiao_id',
foreignTable: 'turma'
}
}).addValue({
name: 'min_year',
table: 'turma',
tableField: 'ano_censo',
resultField: 'year',
where: {
relation: '>=',
type: 'integer',
field: 'ano_censo'
}
}).addValue({
name: 'max_year',
table: 'turma',
tableField: 'ano_censo',
resultField: 'year',
where: {
relation: '<=',
type: 'integer',
field: 'ano_censo'
}
}).addValue({
name:'adm_dependency',
table: 'dependencia_adm',
......
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