From 4a3a7f04bdb9467214fd3d2c2320f722e8f94b57 Mon Sep 17 00:00:00 2001 From: Victor Picussa <vp16@inf.ufpr.br> Date: Mon, 30 Sep 2019 10:09:35 -0300 Subject: [PATCH] [v1.11.16]Added UT modifications --- CHANGELOG.md | 4 +++ src/libs/routes/universityTeacher.js | 40 ++++++++++++++++++---------- 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b62b5382..fe1675a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## 1..11.16 - 2019-10-30 +## Changed +- University Teacher updated + ## 1.11.15 - 2019-10-16 ## Changed - Fix addMissing for classCount route diff --git a/src/libs/routes/universityTeacher.js b/src/libs/routes/universityTeacher.js index 61c296af..42851c2b 100644 --- a/src/libs/routes/universityTeacher.js +++ b/src/libs/routes/universityTeacher.js @@ -46,8 +46,7 @@ let rqf = new ReqQueryFields(); teacherEnrollmentApp.get('/years', (req, res, next) => { req.sql.from('docente_ens_superior') - .field('DISTINCT docente_ens_superior.ano_censo', 'year') - .where('docente_ens_superior.ano_censo = 2017'); + .field('DISTINCT docente_ens_superior.ano_censo', 'year'); next(); }, query, response('years')); @@ -303,13 +302,13 @@ rqf.addField({ }).addValue({ name: 'upper_adm_dependency', table: 'docente_ens_superior', - tableField: 'cod_categoria_administrativa', + tableField: 'par_categoria_administrativa', resultField: 'upper_adm_dependency_id', where: { relation: '=', type: 'integer', table: 'docente_ens_superior', - field: 'cod_categoria_administrativa' + field: 'par_categoria_administrativa' } }).addValue({ name: 'academic_organization', @@ -345,12 +344,12 @@ rqf.addField({ }).addValue({ name:'teacher_situation', table: 'docente_ens_superior', - tableField: 'cod_situacao_docente', + tableField: 'par_situacao_docente', resultField: 'teacher_situation_id', where: { relation: '=', type: 'integer', - field: 'cod_situacao_docente' + field: 'par_situacao_docente' } }).addValue({ name:'work_regime', @@ -455,22 +454,35 @@ rqf.addField({ }).addValue({ name:'deficiency', table: 'docente_ens_superior', - tableField: 'docente_deficiencia', + tableField: 'par_docente_deficiencia', resultField: 'deficiency_id', where: { relation: '=', type: 'integer', - field: 'docente_deficiencia' + field: 'par_docente_deficiencia' } }); teacherEnrollmentApp.get('/', rqf.parse(), (req, res, next) => { - req.sql.field('COUNT(*)', 'total') - .field("'Brasil'", 'name') - .field('docente_ens_superior.ano_censo', 'year') - .from('docente_ens_superior') - .group('docente_ens_superior.ano_censo') - .order('docente_ens_superior.ano_censo') + + if ("university" in req.dims) { + req.sql.field('COUNT(*)', 'total') + .field("'Brasil'", 'name') + .field('docente_ens_superior.ano_censo', 'year') + .from('docente_ens_superior') + .group('docente_ens_superior.cod_ies') + .group('docente_ens_superior.ano_censo') + .order('docente_ens_superior.cod_ies') + .order('docente_ens_superior.ano_censo') + } + else { + req.sql.field('COUNT(*)', 'total') + .field("'Brasil'", 'name') + .field('docente_ens_superior.ano_censo', 'year') + .from('docente_ens_superior') + .group('docente_ens_superior.ano_censo') + .order('docente_ens_superior.ano_censo') + } next(); }, rqf.build(), query, addMissing(rqf), id2str.transform(false), response('teacherEnrollment')); -- GitLab