diff --git a/src/libs/routes/class.js b/src/libs/routes/class.js index 36c2b778ffe114b911756a60a41b2eff868421f4..dc0f02588ef387ad7fb6d6503773754de4a54af5 100644 --- a/src/libs/routes/class.js +++ b/src/libs/routes/class.js @@ -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',