From 1e8d086b9c84e8f8dbf73ea213c384a1e31ffc98 Mon Sep 17 00:00:00 2001 From: ppc19 <ppc19@inf.ufpr.br> Date: Wed, 2 Feb 2022 09:58:07 -0300 Subject: [PATCH 01/40] adapt teacher index to dim school --- src/libs/routes/classroomCount.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/routes/classroomCount.js b/src/libs/routes/classroomCount.js index 249538dd..601b0234 100644 --- a/src/libs/routes/classroomCount.js +++ b/src/libs/routes/classroomCount.js @@ -548,8 +548,8 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => { result.push(obj); currentClassroomObj = obj; - - while (req.teacher[ti].city_id !== classroom.city_id) { // match da tabela de professores. + var id_attribute = req.dims.school ? "school_id" : "city_id" + while (req.teacher[ti][id_attribute] !== classroom[id_attribute]) { // match da tabela de professores. ti++; } -- GitLab From f24218f19078bb6f8d14f0055a4949a19ae6967b Mon Sep 17 00:00:00 2001 From: ppc19 <ppc19@inf.ufpr.br> Date: Fri, 18 Feb 2022 10:51:03 -0300 Subject: [PATCH 02/40] create new route --- src/libs/routes/api.js | 4 + src/libs/routes/courseStudents.js | 192 ++++++++++++++++++++++++++++++ 2 files changed, 196 insertions(+) create mode 100644 src/libs/routes/courseStudents.js diff --git a/src/libs/routes/api.js b/src/libs/routes/api.js index 31fc9257..6a1c2c33 100644 --- a/src/libs/routes/api.js +++ b/src/libs/routes/api.js @@ -130,6 +130,8 @@ const universityLocalOffer = require(`${libs}/routes/universityLocalOffer`); const message = require(`${libs}/routes/message`); +const courseStudents = require(`${libs}/routes/courseStudents`); + api.get('/', (req, res) => { res.json({ msg: 'SimCAQ API is running' }); }); @@ -186,4 +188,6 @@ api.use('/location', location); api.use('/disciplines', disciplines); api.use('/universityLocalOffer', universityLocalOffer); api.use('/message', message); +api.use('/courseStudents', courseStudents); + module.exports = api; diff --git a/src/libs/routes/courseStudents.js b/src/libs/routes/courseStudents.js new file mode 100644 index 00000000..82ca6ca7 --- /dev/null +++ b/src/libs/routes/courseStudents.js @@ -0,0 +1,192 @@ +const express = require('express'); + +const courseStudentsApp = express.Router(); + +const libs = `${process.cwd()}/libs`; + +const squel = require('squel'); + +const query = require(`${libs}/middlewares/query`).query; + +const ReqQueryFields = require(`${libs}/middlewares/reqQueryFields`); + +const response = require(`${libs}/middlewares/response`); + +const id2str = require(`${libs}/middlewares/id2str`); + +let rqf = new ReqQueryFields(); + +rqf.addField({ + name: 'filter', + field: false, + where: true +}).addField({ + name: 'dims', + field: true, + where: false +}).addValueToField({ + name: 'state', + table: 'localoferta_ens_superior2', + tableField: 'cod_uf', + resultField: 'state_id', + where: { + relation: '=', + type: 'integer', + field: 'cod_uf', + table: 'localoferta_ens_superior2' + } +}, 'filter').addValue({ + name: 'mesoregion', + table: 'municipio', + tableField: ['nome_mesorregiao', 'mesorregiao_id'], + resultField: ['mesoregion_name', 'mesoregion_id'], + where: { + relation: '=', + type: 'integer', + field: 'mesorregiao_id', + table: 'municipio' + }, + join: { + primary: 'id', + foreign: 'cod_municipio', + foreignTable: 'localoferta_ens_superior2' + } +}).addValue({ + name: 'microregion', + table: 'municipio', + tableField: ['nome_microrregiao', 'microrregiao_id'], + resultField: ['microregion_name', 'microregion_id'], + where: { + relation: '=', + type: 'integer', + field: 'microrregiao_id', + table: 'municipio' + }, + join: { + primary: 'id', + foreign: 'cod_municipio', + foreignTable: 'localoferta_ens_superior2' + } +}).addValue({ + name: 'city', + table: 'municipio', + tableField: ['id', 'nome'], + resultField: ['city_id', 'city_name'], + where: { + relation: '=', + type: 'integer', + field: 'id', + table: 'municipio' + }, + join: { + primary: 'id', + foreign: 'cod_municipio', + foreignTable: 'localoferta_ens_superior2' + } +}).addValue({ + name: 'min_year', + table: 'localoferta_ens_superior2', + tableField: 'ano_censo', + resultField: 'year', + where: { + relation: '>=', + type: 'integer', + table: 'localoferta_ens_superior2', + field: 'ano_censo' + } +}).addValue({ + name: 'max_year', + table: 'localoferta_ens_superior2', + tableField: 'ano_censo', + resultField: 'year', + where: { + relation: '<=', + type: 'integer', + table: 'localoferta_ens_superior2', + field: 'ano_censo' + } +}).addValue({ + name:'course', + table: 'curso_ens_superior', + tableField: 'nome_curso', + resultField: 'course_name', + where: { + relation: '=', + type: 'string', + field: 'nome_curso' + } +}).addValue({ + name:'upper_education_mod', + table: 'curso_ens_superior', + tableField: 'cod_modalidade_ensino', + resultField: 'upper_education_mod_id', + where: { + relation: '=', + type: 'integer', + field: 'cod_modalidade_ensino' + } +}).addValue({ + name:'upper_adm_dependency', + table: 'curso_ens_superior', + tableField: 'par_categoria_administrativa', + resultField: 'upper_adm_dependency_id', + where: { + relation: '=', + type: 'integer', + field: 'par_categoria_administrativa' + } +}).addValue({ + name:'academic_organization', + table: 'curso_ens_superior', + tableField: 'cod_organizacao_academica', + resultField: 'academic_organization_id', + where: { + relation: '=', + type: 'integer', + field: 'cod_organizacao_academica' + } +}).addValueToField({ + name: 'campi', + table: 'localoferta_ens_superior', + tableField: ['cod_local_oferta', 'nome'], + resultField: ['campi_id', 'campi_name'], + where: { + relation: '=', + type: 'integer', + field: 'cod_local_oferta', + table: 'localoferta_ens_superior' + } +}, 'filter') + +courseStudentsApp.get('/', rqf.parse(), (req, res, next) => { + var b = squel.select().from( + squel.select().from('localoferta_ens_superior') + .field("localoferta_ens_superior.cod_curso", "cod_curso") + .field("localoferta_ens_superior.ano_censo", "ano_censo") + .field("ies_ens_superior.cod_municipio_ies", "cod_municipio") + .field("ies_ens_superior.cod_uf_ies", "cod_uf") + .join("ies_ens_superior on ies_ens_superior.cod_ies = localoferta_ens_superior.cod_ies AND ies_ens_superior.ano_censo=localoferta_ens_superior.ano_censo") + .group("localoferta_ens_superior.cod_curso" ) + .group("localoferta_ens_superior.ano_censo" ) + .group("ies_ens_superior.cod_uf_ies") + .group("ies_ens_superior.cod_municipio_ies") + , "localoferta_ens_superior2") + .field("localoferta_ens_superior2.ano_censo", "year") + .field("SUM(curso_ens_superior.quantidade_inscritos_total)", "inscritos_total") + .field("SUM(curso_ens_superior.quantidade_vagas_totais)", "vagas_totais") + .field("SUM(curso_ens_superior.quantidade_ingresso_curso)", "ingresso_curso") + .join("curso_ens_superior ON (localoferta_ens_superior2.cod_curso = curso_ens_superior.cod_curso) AND (localoferta_ens_superior2.ano_censo = curso_ens_superior.ano_censo)") + .where("curso_ens_superior.cod_nivel_academico = 1") + .where("(curso_ens_superior.tipo_atributo_ingresso <> 1 OR curso_ens_superior.tipo_atributo_ingresso is NULL)") + .where("(curso_ens_superior.cod_grau_academico = 2 OR curso_ens_superior.cod_grau_academico = 4) ") + .group("localoferta_ens_superior2.ano_censo") + .order("localoferta_ens_superior2.ano_censo") + + req.sql = b; + next(); +}, rqf.build(), (req, res, next) => { + console.log(req.sql.toString()); + next(); +}, query, id2str.transform(), response('course_students')) + +module.exports = courseStudentsApp; -- GitLab From 43ecf86fe9e66b86fb909e34b2125bcc711c05d9 Mon Sep 17 00:00:00 2001 From: ppc19 <ppc19@inf.ufpr.br> Date: Fri, 18 Feb 2022 10:56:06 -0300 Subject: [PATCH 03/40] only relation like adds '%' to value --- src/libs/middlewares/reqQueryFields.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/libs/middlewares/reqQueryFields.js b/src/libs/middlewares/reqQueryFields.js index 37a37777..36c33d38 100644 --- a/src/libs/middlewares/reqQueryFields.js +++ b/src/libs/middlewares/reqQueryFields.js @@ -11,10 +11,11 @@ const nullFields = [ "Não classificada" ] -function parseWhereValue(type, value) { +function parseWhereValue(type, value, relation) { if(type === 'integer') return parseInt(value, 10); if(type === 'double') return parseFloat(value); - if(type === 'string') return '%'+value+'%'; + if(type === 'string' && relation === 'LIKE') return '%'+value+'%'; + if(type === 'string') return value; if(type === 'boolean') { if(value === null || typeof value === 'boolean') { return value; @@ -306,14 +307,14 @@ class ReqQueryFields { let whereString = '('; for(let i = 0; i < whereValue.length; ++i) { whereString += whereField; - whereValues.push(parseWhereValue(value.where.type, whereValue[i])); + whereValues.push(parseWhereValue(value.where.type, whereValue[i], value.where.relation)); if(i < whereValue.length-1) { whereString += ' OR '; } } whereString += ')'; } else { - whereValues.push(parseWhereValue(value.where.type, whereValue)); + whereValues.push(parseWhereValue(value.where.type, whereValue, value.where.relation)); } }); @@ -326,7 +327,7 @@ class ReqQueryFields { let arrayWhereValues = []; for(let i = 0; i < whereValue.length; ++i) { let curRelation = value.where.relation; - let curValue = parseWhereValue(value.where.type, whereValue[i]) + let curValue = parseWhereValue(value.where.type, whereValue[i],value.where.relation) if (isNull(k, curValue) ) { curValue = null; curRelation = "is"; @@ -341,7 +342,7 @@ class ReqQueryFields { whereString += ')'; sql.where(whereString, ...arrayWhereValues); } else { - let curValue = parseWhereValue(value.where.type, whereValue) + let curValue = parseWhereValue(value.where.type, whereValue, value.where.relation) let curRelation = value.where.relation; if (isNull(k, curValue) ) { -- GitLab From 649be1441a38d97130a9ef7ae53d6b13625a0824 Mon Sep 17 00:00:00 2001 From: Pietro <ppc19@inf.ufpr.br> Date: Mon, 21 Feb 2022 09:42:08 -0300 Subject: [PATCH 04/40] Hotfix route path --- src/libs/routes/api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/routes/api.js b/src/libs/routes/api.js index 6a1c2c33..7fa6818b 100644 --- a/src/libs/routes/api.js +++ b/src/libs/routes/api.js @@ -188,6 +188,6 @@ api.use('/location', location); api.use('/disciplines', disciplines); api.use('/universityLocalOffer', universityLocalOffer); api.use('/message', message); -api.use('/courseStudents', courseStudents); +api.use('/course_students', courseStudents); module.exports = api; -- GitLab From 45427dc57a258611ec1c7945b9b646efbd1ad977 Mon Sep 17 00:00:00 2001 From: Pietro <ppc19@inf.ufpr.br> Date: Mon, 21 Feb 2022 11:06:12 -0300 Subject: [PATCH 05/40] add total field --- src/libs/routes/courseStudents.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libs/routes/courseStudents.js b/src/libs/routes/courseStudents.js index 82ca6ca7..4b1aab58 100644 --- a/src/libs/routes/courseStudents.js +++ b/src/libs/routes/courseStudents.js @@ -187,6 +187,12 @@ courseStudentsApp.get('/', rqf.parse(), (req, res, next) => { }, rqf.build(), (req, res, next) => { console.log(req.sql.toString()); next(); -}, query, id2str.transform(), response('course_students')) +}, query, (req, res, next) => { + for (var res of req.result){ + res.total = null; + } + + next(); +}, id2str.transform(), response('course_students')) module.exports = courseStudentsApp; -- GitLab From c19cfa18b5d2c37e05c5afa0800bd2c30c5fa32d Mon Sep 17 00:00:00 2001 From: Miguel Salerno <mans17@inf.ufpr.br> Date: Mon, 21 Feb 2022 11:42:44 -0300 Subject: [PATCH 06/40] add subroute for enrolledVacanciesFreshmen --- src/libs/convert/enrolledVacanciesFreshmen.js | 32 +++++++++++++++++++ src/libs/middlewares/id2str.js | 4 ++- src/libs/routes/courseStudents.js | 11 +++++++ 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 src/libs/convert/enrolledVacanciesFreshmen.js diff --git a/src/libs/convert/enrolledVacanciesFreshmen.js b/src/libs/convert/enrolledVacanciesFreshmen.js new file mode 100644 index 00000000..890445cd --- /dev/null +++ b/src/libs/convert/enrolledVacanciesFreshmen.js @@ -0,0 +1,32 @@ +/* +Copyright (C) 2022 Centro de Computacao Cientifica e Software Livre +Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR + +This file is part of simcaq-node. + +simcaq-node is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +simcaq-node is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with simcaq-node. If not, see <https://www.gnu.org/licenses/>. +*/ + +module.exports = function enrolledVacanciesFreshmen(id) { + switch (id) { + case 1: + return 'Ingresso'; + case 2: + return 'Vagas totais'; + case 3: + return 'Inscritos'; + default: + return 'Não definido'; + } +}; diff --git a/src/libs/middlewares/id2str.js b/src/libs/middlewares/id2str.js index b86232ca..fe1bf68d 100644 --- a/src/libs/middlewares/id2str.js +++ b/src/libs/middlewares/id2str.js @@ -89,6 +89,7 @@ const finishUniversity = require(`${libs}/convert/finishUniversity`); const initialTraining = require(`${libs}/convert/initialTraining`); const posTraining = require(`${libs}/convert/posTraining`); const licentiateDegree = require(`${libs}/convert/licentiateDegree`); +const enrolledVacanciesFreshmen = require(`${libs}/convert/enrolledVacanciesFreshmen`); const ids = { gender_id: gender, @@ -169,7 +170,8 @@ const ids = { finish_id: finishUniversity, initial_training_id: initialTraining, pos_training_id: posTraining, - licentiate_degree_id: licentiateDegree + licentiate_degree_id: licentiateDegree, + enrolled_vacancies_freshmen: enrolledVacanciesFreshmen }; function transform(removeId=false) { diff --git a/src/libs/routes/courseStudents.js b/src/libs/routes/courseStudents.js index 4b1aab58..decd65f9 100644 --- a/src/libs/routes/courseStudents.js +++ b/src/libs/routes/courseStudents.js @@ -16,6 +16,17 @@ const id2str = require(`${libs}/middlewares/id2str`); let rqf = new ReqQueryFields(); +courseStudentsApp.get('/enrolled_vacancies_freshmen', (req, res, next) => { + req.result = []; + for(let i = 1; i <= 3; ++i) { + req.result.push({ + id: i, + name: id2str.enrolledVacanciesFreshmen(i) + }); + }; + next(); +}, response('enrolled_vacancies_freshmen')); + rqf.addField({ name: 'filter', field: false, -- GitLab From 6a6351a411f73c559fcd6b19387912b91103a10f Mon Sep 17 00:00:00 2001 From: Miguel Salerno <mans17@inf.ufpr.br> Date: Mon, 21 Feb 2022 11:53:44 -0300 Subject: [PATCH 07/40] add item to id2str --- src/libs/middlewares/id2str.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libs/middlewares/id2str.js b/src/libs/middlewares/id2str.js index fe1bf68d..fa6a20ca 100644 --- a/src/libs/middlewares/id2str.js +++ b/src/libs/middlewares/id2str.js @@ -279,5 +279,6 @@ module.exports = { finishUniversity, initialTraining, posTraining, - licentiateDegree + licentiateDegree, + enrolledVacanciesFreshmen }; -- GitLab From c226133c92fe3ec532275794cf5711fef9b573c6 Mon Sep 17 00:00:00 2001 From: godp21 <godp21@inf.ufpr.br> Date: Tue, 22 Feb 2022 09:28:54 -0300 Subject: [PATCH 08/40] changed results to numbers --- src/libs/routes/courseStudents.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libs/routes/courseStudents.js b/src/libs/routes/courseStudents.js index decd65f9..b50f704a 100644 --- a/src/libs/routes/courseStudents.js +++ b/src/libs/routes/courseStudents.js @@ -200,6 +200,9 @@ courseStudentsApp.get('/', rqf.parse(), (req, res, next) => { next(); }, query, (req, res, next) => { for (var res of req.result){ + res.inscritos_total = Number(res.inscritos_total); + res.vagas_totais = Number(res.vagas_totais); + res.ingresso_curso = Number(res.ingresso_curso); res.total = null; } -- GitLab From 853a34ea1f7f7c124350ae2eb47a9e00d0d58d8f Mon Sep 17 00:00:00 2001 From: godp21 <godp21@inf.ufpr.br> Date: Thu, 3 Mar 2022 10:35:50 -0300 Subject: [PATCH 09/40] testing --- src/libs/routes/api.js | 3 + src/libs/routes/disciplines.js | 2 +- src/libs/routes/tests.js | 200 +++++++++++++++++++++++++++++++++ 3 files changed, 204 insertions(+), 1 deletion(-) create mode 100644 src/libs/routes/tests.js diff --git a/src/libs/routes/api.js b/src/libs/routes/api.js index 7fa6818b..ff770318 100644 --- a/src/libs/routes/api.js +++ b/src/libs/routes/api.js @@ -132,6 +132,8 @@ const message = require(`${libs}/routes/message`); const courseStudents = require(`${libs}/routes/courseStudents`); +const tests = require(`${libs}/routes/tests`); + api.get('/', (req, res) => { res.json({ msg: 'SimCAQ API is running' }); }); @@ -189,5 +191,6 @@ api.use('/disciplines', disciplines); api.use('/universityLocalOffer', universityLocalOffer); api.use('/message', message); api.use('/course_students', courseStudents); +api.use('/tests', tests); module.exports = api; diff --git a/src/libs/routes/disciplines.js b/src/libs/routes/disciplines.js index d43d8d31..23bdcfa3 100644 --- a/src/libs/routes/disciplines.js +++ b/src/libs/routes/disciplines.js @@ -628,7 +628,7 @@ disciplinesApp.get('/', rqf.parse(), (req, res, next) => { // else { let disciplinesNotSuitable = []; let disciplinesSuitable = []; - + console.log(req.result); req.result.forEach((r) => { let objNotSuitable = { total: parseInt(r.total) - parseInt(r.total_suitable), diff --git a/src/libs/routes/tests.js b/src/libs/routes/tests.js new file mode 100644 index 00000000..132a640c --- /dev/null +++ b/src/libs/routes/tests.js @@ -0,0 +1,200 @@ +const express = require('express'); + +const courseStudentsApp = express.Router(); + +const libs = `${process.cwd()}/libs`; + +const squel = require('squel'); + +const query = require(`${libs}/middlewares/query`).query; + +const ReqQueryFields = require(`${libs}/middlewares/reqQueryFields`); + +const response = require(`${libs}/middlewares/response`); + +const id2str = require(`${libs}/middlewares/id2str`); + +let rqf = new ReqQueryFields(); + +courseStudentsApp.get('/enrolled_vacancies_freshmen', (req, res, next) => { + req.result = []; + for(let i = 1; i <= 3; ++i) { + req.result.push({ + id: i, + name: id2str.enrolledVacanciesFreshmen(i) + }); + }; + next(); +}, response('enrolled_vacancies_freshmen')); + +rqf.addField({ + name: 'filter', + field: false, + where: true +}).addField({ + name: 'dims', + field: true, + where: false +}).addValueToField({ + name: 'state', + table: 'localoferta_ens_superior2', + tableField: 'cod_uf', + resultField: 'state_id', + where: { + relation: '=', + type: 'integer', + field: 'cod_uf', + table: 'localoferta_ens_superior2' + } +}, 'filter').addValue({ + name: 'mesoregion', + table: 'municipio', + tableField: ['nome_mesorregiao', 'mesorregiao_id'], + resultField: ['mesoregion_name', 'mesoregion_id'], + where: { + relation: '=', + type: 'integer', + field: 'mesorregiao_id', + table: 'municipio' + }, + join: { + primary: 'id', + foreign: 'cod_municipio', + foreignTable: 'localoferta_ens_superior2' + } +}).addValue({ + name: 'microregion', + table: 'municipio', + tableField: ['nome_microrregiao', 'microrregiao_id'], + resultField: ['microregion_name', 'microregion_id'], + where: { + relation: '=', + type: 'integer', + field: 'microrregiao_id', + table: 'municipio' + }, + join: { + primary: 'id', + foreign: 'cod_municipio', + foreignTable: 'localoferta_ens_superior2' + } +}).addValue({ + name: 'city', + table: 'municipio', + tableField: ['id', 'nome'], + resultField: ['city_id', 'city_name'], + where: { + relation: '=', + type: 'integer', + field: 'id', + table: 'municipio' + }, + join: { + primary: 'id', + foreign: 'cod_municipio', + foreignTable: 'localoferta_ens_superior2' + } +}).addValue({ + name: 'min_year', + table: 'localoferta_ens_superior2', + tableField: 'ano_censo', + resultField: 'year', + where: { + relation: '>=', + type: 'integer', + table: 'localoferta_ens_superior2', + field: 'ano_censo' + } +}).addValue({ + name: 'max_year', + table: 'localoferta_ens_superior2', + tableField: 'ano_censo', + resultField: 'year', + where: { + relation: '<=', + type: 'integer', + table: 'localoferta_ens_superior2', + field: 'ano_censo' + } +}).addValue({ + name:'course', + table: 'curso_ens_superior', + tableField: 'nome_curso', + resultField: 'course_name', + where: { + relation: '=', + type: 'string', + field: 'nome_curso' + } +}).addValue({ + name:'upper_education_mod', + table: 'curso_ens_superior', + tableField: 'cod_modalidade_ensino', + resultField: 'upper_education_mod_id', + where: { + relation: '=', + type: 'integer', + field: 'cod_modalidade_ensino' + } +}).addValue({ + name:'upper_adm_dependency', + table: 'curso_ens_superior', + tableField: 'par_categoria_administrativa', + resultField: 'upper_adm_dependency_id', + where: { + relation: '=', + type: 'integer', + field: 'par_categoria_administrativa' + } +}).addValue({ + name:'academic_organization', + table: 'curso_ens_superior', + tableField: 'cod_organizacao_academica', + resultField: 'academic_organization_id', + where: { + relation: '=', + type: 'integer', + field: 'cod_organizacao_academica' + } +}).addValueToField({ + name: 'campi', + table: 'localoferta_ens_superior', + tableField: ['cod_local_oferta', 'nome'], + resultField: ['campi_id', 'campi_name'], + where: { + relation: '=', + type: 'integer', + field: 'cod_local_oferta', + table: 'localoferta_ens_superior' + } +}, 'filter') + +courseStudentsApp.get('/', rqf.parse(), (req, res, next) => { + req.sql.field("curso_ens_superior.ano_censo") + .field("SUM(curso_ens_superior.quantidade_inscritos_total)", "inscritos_total") + .field("SUM(curso_ens_superior.quantidade_vagas_totais)", "vagas_totais") + .field("SUM(curso_ens_superior.quantidade_ingresso_curso)", "ingresso_curso") + .from("curso_ens_superior") + .join("ies_ens_superior ON curso_ens_superior.ano_censo = ies_ens_superior.ano_censo AND curso_ens_superior.cod_ies = ies_ens_superior.cod_ies") + .where("curso_ens_superior.cod_nivel_academico = 1") + .where("curso_ens_superior.cod_grau_academico = 2 OR curso_ens_superior.cod_grau_academico = 4") + .where("ies_ens_superior.cod_uf_ies = 41") + .group("curso_ens_superior.ano_censo") + .order("curso_ens_superior.ano_censo") + next(); + +}, rqf.build(), (req, res, next) => { + console.log(req.sql.toString()); + next(); +}, query, (req, res, next) => { + for (var res of req.result){ + res.inscritos_total = Number(res.inscritos_total); + res.vagas_totais = Number(res.vagas_totais); + res.ingresso_curso = Number(res.ingresso_curso); + res.total = null; + } + + next(); +}, id2str.transform(), response('course_students')) + +module.exports = courseStudentsApp; -- GitLab From 9b643327eb146a5f66de39dea738e5a03752b9d3 Mon Sep 17 00:00:00 2001 From: godp21 <godp21@inf.ufpr.br> Date: Thu, 3 Mar 2022 11:37:52 -0300 Subject: [PATCH 10/40] testing2 --- src/libs/routes/tests.js | 137 +++++++++++++-------------------------- 1 file changed, 45 insertions(+), 92 deletions(-) diff --git a/src/libs/routes/tests.js b/src/libs/routes/tests.js index 132a640c..639ed7c9 100644 --- a/src/libs/routes/tests.js +++ b/src/libs/routes/tests.js @@ -32,142 +32,96 @@ rqf.addField({ field: false, where: true }).addField({ - name: 'dims', + name: 'dim', field: true, where: false -}).addValueToField({ +}) +.addValueToField({ name: 'state', - table: 'localoferta_ens_superior2', + table: 'ies_ens_superior', tableField: 'cod_uf', resultField: 'state_id', where: { relation: '=', type: 'integer', field: 'cod_uf', - table: 'localoferta_ens_superior2' + table: 'ies_ens_superior' } -}, 'filter').addValue({ - name: 'mesoregion', - table: 'municipio', - tableField: ['nome_mesorregiao', 'mesorregiao_id'], - resultField: ['mesoregion_name', 'mesoregion_id'], - where: { - relation: '=', - type: 'integer', - field: 'mesorregiao_id', - table: 'municipio' - }, - join: { - primary: 'id', - foreign: 'cod_municipio', - foreignTable: 'localoferta_ens_superior2' - } -}).addValue({ - name: 'microregion', - table: 'municipio', - tableField: ['nome_microrregiao', 'microrregiao_id'], - resultField: ['microregion_name', 'microregion_id'], - where: { - relation: '=', - type: 'integer', - field: 'microrregiao_id', - table: 'municipio' - }, - join: { - primary: 'id', - foreign: 'cod_municipio', - foreignTable: 'localoferta_ens_superior2' - } -}).addValue({ - name: 'city', - table: 'municipio', - tableField: ['id', 'nome'], - resultField: ['city_id', 'city_name'], - where: { - relation: '=', - type: 'integer', - field: 'id', - table: 'municipio' - }, - join: { - primary: 'id', - foreign: 'cod_municipio', - foreignTable: 'localoferta_ens_superior2' - } -}).addValue({ +}, 'filter') +.addValueToField({ name: 'min_year', - table: 'localoferta_ens_superior2', + table: 'curso_ens_superior', tableField: 'ano_censo', resultField: 'year', where: { relation: '>=', type: 'integer', - table: 'localoferta_ens_superior2', - field: 'ano_censo' + field: 'ano_censo', + table: 'curso_ens_superior' } -}).addValue({ +}, 'filter') +.addValueToField({ name: 'max_year', - table: 'localoferta_ens_superior2', + table: 'curso_ens_superior', tableField: 'ano_censo', resultField: 'year', where: { relation: '<=', type: 'integer', - table: 'localoferta_ens_superior2', - field: 'ano_censo' + field: 'ano_censo', + table: 'ies_ens_superior' + } +}, 'filter') +.addValue({ + name: 'upper_adm_dependency', + table: 'curso_ens_superior', + tableField: 'par_categoria_administrativa', + resultField: 'upper_adm_dependency_id', + where: { + relation: '=', + type: 'integer', + field: 'par_categoria_administrativa', //cod_categoria_administrativa + table: 'curso_ens_superior' } -}).addValue({ - name:'course', +}) +.addValue({ + name: 'course', table: 'curso_ens_superior', tableField: 'nome_curso', resultField: 'course_name', where: { relation: '=', type: 'string', - field: 'nome_curso' + field: 'nome_curso', + table: 'curso_ens_superior' } -}).addValue({ - name:'upper_education_mod', +}) +.addValue({ + name: 'upper_education_mod', table: 'curso_ens_superior', tableField: 'cod_modalidade_ensino', resultField: 'upper_education_mod_id', where: { relation: '=', type: 'integer', - field: 'cod_modalidade_ensino' - } -}).addValue({ - name:'upper_adm_dependency', - table: 'curso_ens_superior', - tableField: 'par_categoria_administrativa', - resultField: 'upper_adm_dependency_id', - where: { - relation: '=', - type: 'integer', - field: 'par_categoria_administrativa' + field: 'cod_modalidade_ensino', + table: 'curso_ens_superior' } -}).addValue({ - name:'academic_organization', +}) +.addValue({ + name: 'academic_organization', table: 'curso_ens_superior', tableField: 'cod_organizacao_academica', resultField: 'academic_organization_id', where: { relation: '=', type: 'integer', - field: 'cod_organizacao_academica' + field: 'cod_organizacao_academica', + table: 'curso_ens_superior' } -}).addValueToField({ - name: 'campi', - table: 'localoferta_ens_superior', - tableField: ['cod_local_oferta', 'nome'], - resultField: ['campi_id', 'campi_name'], - where: { - relation: '=', - type: 'integer', - field: 'cod_local_oferta', - table: 'localoferta_ens_superior' - } -}, 'filter') +}) + + courseStudentsApp.get('/', rqf.parse(), (req, res, next) => { req.sql.field("curso_ens_superior.ano_censo") @@ -178,7 +132,6 @@ courseStudentsApp.get('/', rqf.parse(), (req, res, next) => { .join("ies_ens_superior ON curso_ens_superior.ano_censo = ies_ens_superior.ano_censo AND curso_ens_superior.cod_ies = ies_ens_superior.cod_ies") .where("curso_ens_superior.cod_nivel_academico = 1") .where("curso_ens_superior.cod_grau_academico = 2 OR curso_ens_superior.cod_grau_academico = 4") - .where("ies_ens_superior.cod_uf_ies = 41") .group("curso_ens_superior.ano_censo") .order("curso_ens_superior.ano_censo") next(); -- GitLab From fa01e30f11947e0a0806cfff4e3614c75c3a4764 Mon Sep 17 00:00:00 2001 From: godp21 <godp21@inf.ufpr.br> Date: Thu, 3 Mar 2022 11:42:12 -0300 Subject: [PATCH 11/40] aaa --- src/libs/routes/tests.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/routes/tests.js b/src/libs/routes/tests.js index 639ed7c9..edc4a227 100644 --- a/src/libs/routes/tests.js +++ b/src/libs/routes/tests.js @@ -39,12 +39,12 @@ rqf.addField({ .addValueToField({ name: 'state', table: 'ies_ens_superior', - tableField: 'cod_uf', + tableField: 'cod_uf_ies', resultField: 'state_id', where: { relation: '=', type: 'integer', - field: 'cod_uf', + field: 'cod_uf_ies', table: 'ies_ens_superior' } }, 'filter') -- GitLab From 0575682f369ba8276888edba9eedce501bfc342e Mon Sep 17 00:00:00 2001 From: godp21 <godp21@inf.ufpr.br> Date: Fri, 4 Mar 2022 08:37:36 -0300 Subject: [PATCH 12/40] updated the courseStudents route --- src/libs/routes/courseStudents.js | 175 ++++++++++-------------------- src/libs/routes/tests.js | 153 -------------------------- 2 files changed, 58 insertions(+), 270 deletions(-) delete mode 100644 src/libs/routes/tests.js diff --git a/src/libs/routes/courseStudents.js b/src/libs/routes/courseStudents.js index b50f704a..edc4a227 100644 --- a/src/libs/routes/courseStudents.js +++ b/src/libs/routes/courseStudents.js @@ -32,169 +32,110 @@ rqf.addField({ field: false, where: true }).addField({ - name: 'dims', + name: 'dim', field: true, where: false -}).addValueToField({ +}) +.addValueToField({ name: 'state', - table: 'localoferta_ens_superior2', - tableField: 'cod_uf', + table: 'ies_ens_superior', + tableField: 'cod_uf_ies', resultField: 'state_id', where: { relation: '=', type: 'integer', - field: 'cod_uf', - table: 'localoferta_ens_superior2' + field: 'cod_uf_ies', + table: 'ies_ens_superior' } -}, 'filter').addValue({ - name: 'mesoregion', - table: 'municipio', - tableField: ['nome_mesorregiao', 'mesorregiao_id'], - resultField: ['mesoregion_name', 'mesoregion_id'], - where: { - relation: '=', - type: 'integer', - field: 'mesorregiao_id', - table: 'municipio' - }, - join: { - primary: 'id', - foreign: 'cod_municipio', - foreignTable: 'localoferta_ens_superior2' - } -}).addValue({ - name: 'microregion', - table: 'municipio', - tableField: ['nome_microrregiao', 'microrregiao_id'], - resultField: ['microregion_name', 'microregion_id'], - where: { - relation: '=', - type: 'integer', - field: 'microrregiao_id', - table: 'municipio' - }, - join: { - primary: 'id', - foreign: 'cod_municipio', - foreignTable: 'localoferta_ens_superior2' - } -}).addValue({ - name: 'city', - table: 'municipio', - tableField: ['id', 'nome'], - resultField: ['city_id', 'city_name'], - where: { - relation: '=', - type: 'integer', - field: 'id', - table: 'municipio' - }, - join: { - primary: 'id', - foreign: 'cod_municipio', - foreignTable: 'localoferta_ens_superior2' - } -}).addValue({ +}, 'filter') +.addValueToField({ name: 'min_year', - table: 'localoferta_ens_superior2', + table: 'curso_ens_superior', tableField: 'ano_censo', resultField: 'year', where: { relation: '>=', type: 'integer', - table: 'localoferta_ens_superior2', - field: 'ano_censo' + field: 'ano_censo', + table: 'curso_ens_superior' } -}).addValue({ +}, 'filter') +.addValueToField({ name: 'max_year', - table: 'localoferta_ens_superior2', + table: 'curso_ens_superior', tableField: 'ano_censo', resultField: 'year', where: { relation: '<=', type: 'integer', - table: 'localoferta_ens_superior2', - field: 'ano_censo' + field: 'ano_censo', + table: 'ies_ens_superior' } -}).addValue({ - name:'course', +}, 'filter') +.addValue({ + name: 'upper_adm_dependency', + table: 'curso_ens_superior', + tableField: 'par_categoria_administrativa', + resultField: 'upper_adm_dependency_id', + where: { + relation: '=', + type: 'integer', + field: 'par_categoria_administrativa', //cod_categoria_administrativa + table: 'curso_ens_superior' + } +}) +.addValue({ + name: 'course', table: 'curso_ens_superior', tableField: 'nome_curso', resultField: 'course_name', where: { relation: '=', type: 'string', - field: 'nome_curso' + field: 'nome_curso', + table: 'curso_ens_superior' } -}).addValue({ - name:'upper_education_mod', +}) +.addValue({ + name: 'upper_education_mod', table: 'curso_ens_superior', tableField: 'cod_modalidade_ensino', resultField: 'upper_education_mod_id', where: { relation: '=', type: 'integer', - field: 'cod_modalidade_ensino' - } -}).addValue({ - name:'upper_adm_dependency', - table: 'curso_ens_superior', - tableField: 'par_categoria_administrativa', - resultField: 'upper_adm_dependency_id', - where: { - relation: '=', - type: 'integer', - field: 'par_categoria_administrativa' + field: 'cod_modalidade_ensino', + table: 'curso_ens_superior' } -}).addValue({ - name:'academic_organization', +}) +.addValue({ + name: 'academic_organization', table: 'curso_ens_superior', tableField: 'cod_organizacao_academica', resultField: 'academic_organization_id', where: { relation: '=', type: 'integer', - field: 'cod_organizacao_academica' - } -}).addValueToField({ - name: 'campi', - table: 'localoferta_ens_superior', - tableField: ['cod_local_oferta', 'nome'], - resultField: ['campi_id', 'campi_name'], - where: { - relation: '=', - type: 'integer', - field: 'cod_local_oferta', - table: 'localoferta_ens_superior' + field: 'cod_organizacao_academica', + table: 'curso_ens_superior' } -}, 'filter') +}) + + courseStudentsApp.get('/', rqf.parse(), (req, res, next) => { - var b = squel.select().from( - squel.select().from('localoferta_ens_superior') - .field("localoferta_ens_superior.cod_curso", "cod_curso") - .field("localoferta_ens_superior.ano_censo", "ano_censo") - .field("ies_ens_superior.cod_municipio_ies", "cod_municipio") - .field("ies_ens_superior.cod_uf_ies", "cod_uf") - .join("ies_ens_superior on ies_ens_superior.cod_ies = localoferta_ens_superior.cod_ies AND ies_ens_superior.ano_censo=localoferta_ens_superior.ano_censo") - .group("localoferta_ens_superior.cod_curso" ) - .group("localoferta_ens_superior.ano_censo" ) - .group("ies_ens_superior.cod_uf_ies") - .group("ies_ens_superior.cod_municipio_ies") - , "localoferta_ens_superior2") - .field("localoferta_ens_superior2.ano_censo", "year") - .field("SUM(curso_ens_superior.quantidade_inscritos_total)", "inscritos_total") - .field("SUM(curso_ens_superior.quantidade_vagas_totais)", "vagas_totais") - .field("SUM(curso_ens_superior.quantidade_ingresso_curso)", "ingresso_curso") - .join("curso_ens_superior ON (localoferta_ens_superior2.cod_curso = curso_ens_superior.cod_curso) AND (localoferta_ens_superior2.ano_censo = curso_ens_superior.ano_censo)") - .where("curso_ens_superior.cod_nivel_academico = 1") - .where("(curso_ens_superior.tipo_atributo_ingresso <> 1 OR curso_ens_superior.tipo_atributo_ingresso is NULL)") - .where("(curso_ens_superior.cod_grau_academico = 2 OR curso_ens_superior.cod_grau_academico = 4) ") - .group("localoferta_ens_superior2.ano_censo") - .order("localoferta_ens_superior2.ano_censo") - - req.sql = b; + req.sql.field("curso_ens_superior.ano_censo") + .field("SUM(curso_ens_superior.quantidade_inscritos_total)", "inscritos_total") + .field("SUM(curso_ens_superior.quantidade_vagas_totais)", "vagas_totais") + .field("SUM(curso_ens_superior.quantidade_ingresso_curso)", "ingresso_curso") + .from("curso_ens_superior") + .join("ies_ens_superior ON curso_ens_superior.ano_censo = ies_ens_superior.ano_censo AND curso_ens_superior.cod_ies = ies_ens_superior.cod_ies") + .where("curso_ens_superior.cod_nivel_academico = 1") + .where("curso_ens_superior.cod_grau_academico = 2 OR curso_ens_superior.cod_grau_academico = 4") + .group("curso_ens_superior.ano_censo") + .order("curso_ens_superior.ano_censo") next(); + }, rqf.build(), (req, res, next) => { console.log(req.sql.toString()); next(); diff --git a/src/libs/routes/tests.js b/src/libs/routes/tests.js deleted file mode 100644 index edc4a227..00000000 --- a/src/libs/routes/tests.js +++ /dev/null @@ -1,153 +0,0 @@ -const express = require('express'); - -const courseStudentsApp = express.Router(); - -const libs = `${process.cwd()}/libs`; - -const squel = require('squel'); - -const query = require(`${libs}/middlewares/query`).query; - -const ReqQueryFields = require(`${libs}/middlewares/reqQueryFields`); - -const response = require(`${libs}/middlewares/response`); - -const id2str = require(`${libs}/middlewares/id2str`); - -let rqf = new ReqQueryFields(); - -courseStudentsApp.get('/enrolled_vacancies_freshmen', (req, res, next) => { - req.result = []; - for(let i = 1; i <= 3; ++i) { - req.result.push({ - id: i, - name: id2str.enrolledVacanciesFreshmen(i) - }); - }; - next(); -}, response('enrolled_vacancies_freshmen')); - -rqf.addField({ - name: 'filter', - field: false, - where: true -}).addField({ - name: 'dim', - field: true, - where: false -}) -.addValueToField({ - name: 'state', - table: 'ies_ens_superior', - tableField: 'cod_uf_ies', - resultField: 'state_id', - where: { - relation: '=', - type: 'integer', - field: 'cod_uf_ies', - table: 'ies_ens_superior' - } -}, 'filter') -.addValueToField({ - name: 'min_year', - table: 'curso_ens_superior', - tableField: 'ano_censo', - resultField: 'year', - where: { - relation: '>=', - type: 'integer', - field: 'ano_censo', - table: 'curso_ens_superior' - } -}, 'filter') -.addValueToField({ - name: 'max_year', - table: 'curso_ens_superior', - tableField: 'ano_censo', - resultField: 'year', - where: { - relation: '<=', - type: 'integer', - field: 'ano_censo', - table: 'ies_ens_superior' - } -}, 'filter') -.addValue({ - name: 'upper_adm_dependency', - table: 'curso_ens_superior', - tableField: 'par_categoria_administrativa', - resultField: 'upper_adm_dependency_id', - where: { - relation: '=', - type: 'integer', - field: 'par_categoria_administrativa', //cod_categoria_administrativa - table: 'curso_ens_superior' - } -}) -.addValue({ - name: 'course', - table: 'curso_ens_superior', - tableField: 'nome_curso', - resultField: 'course_name', - where: { - relation: '=', - type: 'string', - field: 'nome_curso', - table: 'curso_ens_superior' - } -}) -.addValue({ - name: 'upper_education_mod', - table: 'curso_ens_superior', - tableField: 'cod_modalidade_ensino', - resultField: 'upper_education_mod_id', - where: { - relation: '=', - type: 'integer', - field: 'cod_modalidade_ensino', - table: 'curso_ens_superior' - } -}) -.addValue({ - name: 'academic_organization', - table: 'curso_ens_superior', - tableField: 'cod_organizacao_academica', - resultField: 'academic_organization_id', - where: { - relation: '=', - type: 'integer', - field: 'cod_organizacao_academica', - table: 'curso_ens_superior' - } -}) - - - -courseStudentsApp.get('/', rqf.parse(), (req, res, next) => { - req.sql.field("curso_ens_superior.ano_censo") - .field("SUM(curso_ens_superior.quantidade_inscritos_total)", "inscritos_total") - .field("SUM(curso_ens_superior.quantidade_vagas_totais)", "vagas_totais") - .field("SUM(curso_ens_superior.quantidade_ingresso_curso)", "ingresso_curso") - .from("curso_ens_superior") - .join("ies_ens_superior ON curso_ens_superior.ano_censo = ies_ens_superior.ano_censo AND curso_ens_superior.cod_ies = ies_ens_superior.cod_ies") - .where("curso_ens_superior.cod_nivel_academico = 1") - .where("curso_ens_superior.cod_grau_academico = 2 OR curso_ens_superior.cod_grau_academico = 4") - .group("curso_ens_superior.ano_censo") - .order("curso_ens_superior.ano_censo") - next(); - -}, rqf.build(), (req, res, next) => { - console.log(req.sql.toString()); - next(); -}, query, (req, res, next) => { - for (var res of req.result){ - res.inscritos_total = Number(res.inscritos_total); - res.vagas_totais = Number(res.vagas_totais); - res.ingresso_curso = Number(res.ingresso_curso); - res.total = null; - } - - next(); -}, id2str.transform(), response('course_students')) - -module.exports = courseStudentsApp; -- GitLab From 1d0aef8101cc770ca6d70d1139bd7c4deff264f6 Mon Sep 17 00:00:00 2001 From: Pietro <ppc19@inf.ufpr.br> Date: Thu, 10 Mar 2022 09:01:15 -0300 Subject: [PATCH 13/40] add period_not filter in enrollment --- src/libs/routes/enrollment.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/libs/routes/enrollment.js b/src/libs/routes/enrollment.js index b3310b30..c3a1e68d 100644 --- a/src/libs/routes/enrollment.js +++ b/src/libs/routes/enrollment.js @@ -588,6 +588,16 @@ rqf.addField({ type: 'boolean', field: 'exclusiva_especial' } +}).addValue({ + name: 'period_not', + table: 'matricula', + tableField: 'turma_turno_id', + resultField: 'period_id', + where: { + relation: '<>', + type: 'integer', + field: 'turma_turno_id' + } }); enrollmentApp.get('/', rqf.parse(), (req, res, next) => { -- GitLab From 9e11a7dfe40e194c53460a8b2906ea99862a96ac Mon Sep 17 00:00:00 2001 From: godp21 <godp21@inf.ufpr.br> Date: Thu, 10 Mar 2022 09:06:43 -0300 Subject: [PATCH 14/40] removed tests route on api.js --- src/libs/routes/api.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/libs/routes/api.js b/src/libs/routes/api.js index ff770318..7fa6818b 100644 --- a/src/libs/routes/api.js +++ b/src/libs/routes/api.js @@ -132,8 +132,6 @@ const message = require(`${libs}/routes/message`); const courseStudents = require(`${libs}/routes/courseStudents`); -const tests = require(`${libs}/routes/tests`); - api.get('/', (req, res) => { res.json({ msg: 'SimCAQ API is running' }); }); @@ -191,6 +189,5 @@ api.use('/disciplines', disciplines); api.use('/universityLocalOffer', universityLocalOffer); api.use('/message', message); api.use('/course_students', courseStudents); -api.use('/tests', tests); module.exports = api; -- GitLab From 3222e5134b235d8f19a5efbbacfd5c115c3a4879 Mon Sep 17 00:00:00 2001 From: ppc19 <ppc19@inf.ufpr.br> Date: Fri, 11 Mar 2022 09:47:14 -0300 Subject: [PATCH 15/40] Hotfix dim to dims --- src/libs/routes/courseStudents.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/routes/courseStudents.js b/src/libs/routes/courseStudents.js index edc4a227..19349f2f 100644 --- a/src/libs/routes/courseStudents.js +++ b/src/libs/routes/courseStudents.js @@ -32,7 +32,7 @@ rqf.addField({ field: false, where: true }).addField({ - name: 'dim', + name: 'dims', field: true, where: false }) -- GitLab From c10a03ff7bf12b274ca517abceb4f17ef4c45c71 Mon Sep 17 00:00:00 2001 From: ppc19 <ppc19@inf.ufpr.br> Date: Fri, 11 Mar 2022 10:14:16 -0300 Subject: [PATCH 16/40] add filters --- src/libs/routes/courseStudents.js | 51 +++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/src/libs/routes/courseStudents.js b/src/libs/routes/courseStudents.js index edc4a227..f3c67678 100644 --- a/src/libs/routes/courseStudents.js +++ b/src/libs/routes/courseStudents.js @@ -120,6 +120,57 @@ rqf.addField({ table: 'curso_ens_superior' } }) +.addValue({ + name: 'mesoregion', + table: 'municipio', + tableField: ['nome_mesorregiao', 'mesorregiao_id'], + resultField: ['mesoregion_name', 'mesoregion_id'], + where: { + relation: '=', + type: 'integer', + field: 'mesorregiao_id', + table: 'municipio' + }, + join: { + primary: 'id', + foreign: 'cod_municipio_ies', + foreignTable: 'ies_ens_superior' + } +}) +.addValue({ + name: 'microregion', + table: 'municipio', + tableField: ['nome_microrregiao', 'microrregiao_id'], + resultField: ['microregion_name', 'microregion_id'], + where: { + relation: '=', + type: 'integer', + field: 'microrregiao_id', + table: 'municipio' + }, + join: { + primary: 'id', + foreign: 'cod_municipio_ies', + foreignTable: 'ies_ens_superior' + } +}) +.addValue({ + name: 'city', + table: 'municipio', + tableField: ['id', 'nome'], + resultField: ['city_id', 'city_name'], + where: { + relation: '=', + type: 'integer', + field: 'id', + table: 'municipio' + }, + join: { + primary: 'id', + foreign: 'cod_municipio_ies', + foreignTable: 'ies_ens_superior' + } +}) -- GitLab From f92086ecc9f881b7f382957f437cff345421e91a Mon Sep 17 00:00:00 2001 From: ppc19 <ppc19@inf.ufpr.br> Date: Fri, 11 Mar 2022 10:25:27 -0300 Subject: [PATCH 17/40] add city filters to courseStudents --- src/libs/routes/courseStudents.js | 51 +++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/src/libs/routes/courseStudents.js b/src/libs/routes/courseStudents.js index 19349f2f..afe2cfdf 100644 --- a/src/libs/routes/courseStudents.js +++ b/src/libs/routes/courseStudents.js @@ -120,6 +120,57 @@ rqf.addField({ table: 'curso_ens_superior' } }) +.addValue({ + name: 'mesoregion', + table: 'municipio', + tableField: ['nome_mesorregiao', 'mesorregiao_id'], + resultField: ['mesoregion_name', 'mesoregion_id'], + where: { + relation: '=', + type: 'integer', + field: 'mesorregiao_id', + table: 'municipio' + }, + join: { + primary: 'id', + foreign: 'cod_municipio_ies', + foreignTable: 'ies_ens_superior' + } +}) +.addValue({ + name: 'microregion', + table: 'municipio', + tableField: ['nome_microrregiao', 'microrregiao_id'], + resultField: ['microregion_name', 'microregion_id'], + where: { + relation: '=', + type: 'integer', + field: 'microrregiao_id', + table: 'municipio' + }, + join: { + primary: 'id', + foreign: 'cod_municipio_ies', + foreignTable: 'ies_ens_superior' + } +}) +.addValue({ + name: 'city', + table: 'municipio', + tableField: ['id', 'nome'], + resultField: ['city_id', 'city_name'], + where: { + relation: '=', + type: 'integer', + field: 'id', + table: 'municipio' + }, + join: { + primary: 'id', + foreign: 'cod_municipio_ies', + foreignTable: 'ies_ens_superior' + } +}) -- GitLab From d5a7ff9a82e25958ef6fadd03110430462321d7f Mon Sep 17 00:00:00 2001 From: ppc19 <ppc19@inf.ufpr.br> Date: Fri, 11 Mar 2022 11:17:22 -0300 Subject: [PATCH 18/40] hotfix year --- src/libs/routes/courseStudents.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/routes/courseStudents.js b/src/libs/routes/courseStudents.js index afe2cfdf..cd0aea1b 100644 --- a/src/libs/routes/courseStudents.js +++ b/src/libs/routes/courseStudents.js @@ -175,7 +175,7 @@ rqf.addField({ courseStudentsApp.get('/', rqf.parse(), (req, res, next) => { - req.sql.field("curso_ens_superior.ano_censo") + req.sql.field("curso_ens_superior.ano_censo", "year") .field("SUM(curso_ens_superior.quantidade_inscritos_total)", "inscritos_total") .field("SUM(curso_ens_superior.quantidade_vagas_totais)", "vagas_totais") .field("SUM(curso_ens_superior.quantidade_ingresso_curso)", "ingresso_curso") -- GitLab From e9d423efb33391fcd0da091c631750e52aa34c01 Mon Sep 17 00:00:00 2001 From: godp21 <godp21@inf.ufpr.br> Date: Tue, 22 Mar 2022 09:32:01 -0300 Subject: [PATCH 19/40] added route to enter_situation --- src/libs/routes/universityEnrollment.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libs/routes/universityEnrollment.js b/src/libs/routes/universityEnrollment.js index f12626f3..15ce729d 100644 --- a/src/libs/routes/universityEnrollment.js +++ b/src/libs/routes/universityEnrollment.js @@ -736,5 +736,9 @@ universityEnrollmentApp.get('/', rqf.parse(), (req, res, next) => { } next() }, response('universityEnrollment')); +universityEnrollmentApp.get('/enter_situation ', rqf.parse(), (req, res, next) => { + + next() +}, rqf.build(), query, id2str.transform(), response('universityEnrollment')); module.exports = universityEnrollmentApp; -- GitLab From e834d9f877b31557d9dc48274523ccac45e697dc Mon Sep 17 00:00:00 2001 From: godp21 <godp21@inf.ufpr.br> Date: Tue, 22 Mar 2022 09:41:35 -0300 Subject: [PATCH 20/40] added route to enter_situation --- src/libs/routes/universityEnrollment.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/libs/routes/universityEnrollment.js b/src/libs/routes/universityEnrollment.js index 15ce729d..c9c045af 100644 --- a/src/libs/routes/universityEnrollment.js +++ b/src/libs/routes/universityEnrollment.js @@ -736,9 +736,18 @@ universityEnrollmentApp.get('/', rqf.parse(), (req, res, next) => { } next() }, response('universityEnrollment')); -universityEnrollmentApp.get('/enter_situation ', rqf.parse(), (req, res, next) => { - +universityEnrollmentApp.get('/enter_situation ', rqf.parse(), (req, res, next) => { + req.sql.from('localoferta_ens_superior_matricula2') + .field('SUM(CASE WHEN cod_aluno_situacao=2 THEN 1 ELSE 0 END)', 'cursando') + .field('SUM(CASE WHEN cod_aluno_situacao=6 THEN 1 ELSE 0 END)', 'concluinte') + .field('SUM(CASE WHEN cod_aluno_situacao=4 OR cod_aluno_situacao=5 OR cod_aluno_situacao=7 THEN 1 ELSE 0 END)', 'evadido') + .field('SUM(CASE WHEN cod_aluno_situacao=3 THEN 1 ELSE 0 END)', 'trancado') + .field('COUNT(*)', 'total') + .where('ano_censo=2018') + .where('cod_nivel_academico=1') + .where('cod_grau_academico=2 OR cod_grau_academico=4') + .where('localoferta_cod_uf=41') next() }, rqf.build(), query, id2str.transform(), response('universityEnrollment')); module.exports = universityEnrollmentApp; -- GitLab From 29de6b069651b7b74851655c66e3862d1e10cace Mon Sep 17 00:00:00 2001 From: godp21 <godp21@inf.ufpr.br> Date: Tue, 22 Mar 2022 10:07:28 -0300 Subject: [PATCH 21/40] switched results to numbers --- src/libs/routes/universityEnrollment.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/libs/routes/universityEnrollment.js b/src/libs/routes/universityEnrollment.js index c9c045af..69509042 100644 --- a/src/libs/routes/universityEnrollment.js +++ b/src/libs/routes/universityEnrollment.js @@ -739,15 +739,23 @@ universityEnrollmentApp.get('/', rqf.parse(), (req, res, next) => { universityEnrollmentApp.get('/enter_situation ', rqf.parse(), (req, res, next) => { req.sql.from('localoferta_ens_superior_matricula2') - .field('SUM(CASE WHEN cod_aluno_situacao=2 THEN 1 ELSE 0 END)', 'cursando') - .field('SUM(CASE WHEN cod_aluno_situacao=6 THEN 1 ELSE 0 END)', 'concluinte') - .field('SUM(CASE WHEN cod_aluno_situacao=4 OR cod_aluno_situacao=5 OR cod_aluno_situacao=7 THEN 1 ELSE 0 END)', 'evadido') - .field('SUM(CASE WHEN cod_aluno_situacao=3 THEN 1 ELSE 0 END)', 'trancado') + .field('SUM(CASE WHEN cod_aluno_situacao=2 AND ingressante=1 THEN 1 ELSE 0 END)', 'cursando') + .field('SUM(CASE WHEN cod_aluno_situacao=6 AND ingressante=1THEN 1 ELSE 0 END)', 'concluinte') + .field('SUM(CASE WHEN (cod_aluno_situacao=4 OR cod_aluno_situacao=5 OR cod_aluno_situacao=7) AND ingressante=1 THEN 1 ELSE 0 END)', 'evadido') + .field('SUM(CASE WHEN cod_aluno_situacao=3 AND ingressante=1 THEN 1 ELSE 0 END)', 'trancado') .field('COUNT(*)', 'total') .where('ano_censo=2018') .where('cod_nivel_academico=1') .where('cod_grau_academico=2 OR cod_grau_academico=4') .where('localoferta_cod_uf=41') next() -}, rqf.build(), query, id2str.transform(), response('universityEnrollment')); +}, rqf.build(), query, (req, res, next) => { + for (var res of req.result){ + res.cursando = Number(res.cursando); + res.concluinte = Number(res.concluinte); + res.evadido = Number(res.evadido); + } + + next(); +}, id2str.transform(), response('enterSituation')); module.exports = universityEnrollmentApp; -- GitLab From 376480329f26b4ecf41f6de755eac59ccabb8b18 Mon Sep 17 00:00:00 2001 From: godp21 <godp21@inf.ufpr.br> Date: Tue, 22 Mar 2022 10:08:57 -0300 Subject: [PATCH 22/40] switched results to numbers and fixed a bug --- src/libs/routes/universityEnrollment.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/routes/universityEnrollment.js b/src/libs/routes/universityEnrollment.js index 69509042..707dbea5 100644 --- a/src/libs/routes/universityEnrollment.js +++ b/src/libs/routes/universityEnrollment.js @@ -737,7 +737,7 @@ universityEnrollmentApp.get('/', rqf.parse(), (req, res, next) => { next() }, response('universityEnrollment')); -universityEnrollmentApp.get('/enter_situation ', rqf.parse(), (req, res, next) => { +universityEnrollmentApp.get('/enter_situation', rqf.parse(), (req, res, next) => { req.sql.from('localoferta_ens_superior_matricula2') .field('SUM(CASE WHEN cod_aluno_situacao=2 AND ingressante=1 THEN 1 ELSE 0 END)', 'cursando') .field('SUM(CASE WHEN cod_aluno_situacao=6 AND ingressante=1THEN 1 ELSE 0 END)', 'concluinte') -- GitLab From ade9839b4b0db2d5cb1c34a8ecb9f26266fa41d1 Mon Sep 17 00:00:00 2001 From: godp21 <godp21@inf.ufpr.br> Date: Tue, 22 Mar 2022 10:12:20 -0300 Subject: [PATCH 23/40] added number conversion to 'trancado' indicator --- src/libs/routes/universityEnrollment.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/routes/universityEnrollment.js b/src/libs/routes/universityEnrollment.js index 707dbea5..15f695f9 100644 --- a/src/libs/routes/universityEnrollment.js +++ b/src/libs/routes/universityEnrollment.js @@ -754,6 +754,7 @@ universityEnrollmentApp.get('/enter_situation', rqf.parse(), (req, res, next) => res.cursando = Number(res.cursando); res.concluinte = Number(res.concluinte); res.evadido = Number(res.evadido); + res.trancado = Number(res.trancado); } next(); -- GitLab From 76ae97e654c21e842a20108d81d00cbdeabc7870 Mon Sep 17 00:00:00 2001 From: godp21 <godp21@inf.ufpr.br> Date: Tue, 22 Mar 2022 10:33:57 -0300 Subject: [PATCH 24/40] adding year order --- src/libs/routes/universityEnrollment.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/libs/routes/universityEnrollment.js b/src/libs/routes/universityEnrollment.js index 15f695f9..943d0622 100644 --- a/src/libs/routes/universityEnrollment.js +++ b/src/libs/routes/universityEnrollment.js @@ -739,15 +739,18 @@ universityEnrollmentApp.get('/', rqf.parse(), (req, res, next) => { universityEnrollmentApp.get('/enter_situation', rqf.parse(), (req, res, next) => { req.sql.from('localoferta_ens_superior_matricula2') - .field('SUM(CASE WHEN cod_aluno_situacao=2 AND ingressante=1 THEN 1 ELSE 0 END)', 'cursando') - .field('SUM(CASE WHEN cod_aluno_situacao=6 AND ingressante=1THEN 1 ELSE 0 END)', 'concluinte') - .field('SUM(CASE WHEN (cod_aluno_situacao=4 OR cod_aluno_situacao=5 OR cod_aluno_situacao=7) AND ingressante=1 THEN 1 ELSE 0 END)', 'evadido') - .field('SUM(CASE WHEN cod_aluno_situacao=3 AND ingressante=1 THEN 1 ELSE 0 END)', 'trancado') + .field('SUM(CASE WHEN localoferta_ens_superior_matricula2.cod_aluno_situacao=2 AND localoferta_ens_superior_matricula2.ingressante=1 THEN 1 ELSE 0 END)', 'cursando') + .field('SUM(CASE WHEN localoferta_ens_superior_matricula2.cod_aluno_situacao=6 AND localoferta_ens_superior_matricula2.ingressante=1THEN 1 ELSE 0 END)', 'concluinte') + .field('SUM(CASE WHEN (localoferta_ens_superior_matricula2.cod_aluno_situacao=4 OR localoferta_ens_superior_matricula2.cod_aluno_situacao=5 OR localoferta_ens_superior_matricula2.cod_aluno_situacao=7) AND localoferta_ens_superior_matricula2.ingressante=1 THEN 1 ELSE 0 END)', 'evadido') + .field('SUM(CASE WHEN localoferta_ens_superior_matricula2.cod_aluno_situacao=3 AND localoferta_ens_superior_matricula2.ingressante=1 THEN 1 ELSE 0 END)', 'trancado') .field('COUNT(*)', 'total') - .where('ano_censo=2018') - .where('cod_nivel_academico=1') - .where('cod_grau_academico=2 OR cod_grau_academico=4') - .where('localoferta_cod_uf=41') + .field('localoferta_ens_superior_matricula2.ano_censo') + .where('localoferta_ens_superior_matricula2.ano_censo=2018') + .where('localoferta_ens_superior_matricula2.cod_nivel_academico=1') + .where('localoferta_ens_superior_matricula2.cod_grau_academico=2 OR localoferta_ens_superior_matricula2.od_grau_academico=4') + .where('localoferta_ens_superior_matricula2.localoferta_cod_uf=41') + .group('localoferta_ens_superior_matricula2.ano_censo') + .order('localoferta_ens_superior_matricula2.ano_censo') next() }, rqf.build(), query, (req, res, next) => { for (var res of req.result){ -- GitLab From cf727c39799cf6cbcc718838cc2b303f149c4e86 Mon Sep 17 00:00:00 2001 From: godp21 <godp21@inf.ufpr.br> Date: Tue, 22 Mar 2022 10:58:29 -0300 Subject: [PATCH 25/40] adding year order --- src/libs/routes/universityEnrollment.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/routes/universityEnrollment.js b/src/libs/routes/universityEnrollment.js index 943d0622..21f6ec34 100644 --- a/src/libs/routes/universityEnrollment.js +++ b/src/libs/routes/universityEnrollment.js @@ -740,7 +740,7 @@ universityEnrollmentApp.get('/', rqf.parse(), (req, res, next) => { universityEnrollmentApp.get('/enter_situation', rqf.parse(), (req, res, next) => { req.sql.from('localoferta_ens_superior_matricula2') .field('SUM(CASE WHEN localoferta_ens_superior_matricula2.cod_aluno_situacao=2 AND localoferta_ens_superior_matricula2.ingressante=1 THEN 1 ELSE 0 END)', 'cursando') - .field('SUM(CASE WHEN localoferta_ens_superior_matricula2.cod_aluno_situacao=6 AND localoferta_ens_superior_matricula2.ingressante=1THEN 1 ELSE 0 END)', 'concluinte') + .field('SUM(CASE WHEN localoferta_ens_superior_matricula2.cod_aluno_situacao=6 AND localoferta_ens_superior_matricula2.ingressante=1 THEN 1 ELSE 0 END)', 'concluinte') .field('SUM(CASE WHEN (localoferta_ens_superior_matricula2.cod_aluno_situacao=4 OR localoferta_ens_superior_matricula2.cod_aluno_situacao=5 OR localoferta_ens_superior_matricula2.cod_aluno_situacao=7) AND localoferta_ens_superior_matricula2.ingressante=1 THEN 1 ELSE 0 END)', 'evadido') .field('SUM(CASE WHEN localoferta_ens_superior_matricula2.cod_aluno_situacao=3 AND localoferta_ens_superior_matricula2.ingressante=1 THEN 1 ELSE 0 END)', 'trancado') .field('COUNT(*)', 'total') -- GitLab From 11029533b09fd2bf2fdb3db5cec89570a8b24f13 Mon Sep 17 00:00:00 2001 From: godp21 <godp21@inf.ufpr.br> Date: Tue, 22 Mar 2022 10:59:07 -0300 Subject: [PATCH 26/40] adding year order --- src/libs/routes/universityEnrollment.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/libs/routes/universityEnrollment.js b/src/libs/routes/universityEnrollment.js index 21f6ec34..913b6e66 100644 --- a/src/libs/routes/universityEnrollment.js +++ b/src/libs/routes/universityEnrollment.js @@ -745,10 +745,8 @@ universityEnrollmentApp.get('/enter_situation', rqf.parse(), (req, res, next) => .field('SUM(CASE WHEN localoferta_ens_superior_matricula2.cod_aluno_situacao=3 AND localoferta_ens_superior_matricula2.ingressante=1 THEN 1 ELSE 0 END)', 'trancado') .field('COUNT(*)', 'total') .field('localoferta_ens_superior_matricula2.ano_censo') - .where('localoferta_ens_superior_matricula2.ano_censo=2018') .where('localoferta_ens_superior_matricula2.cod_nivel_academico=1') .where('localoferta_ens_superior_matricula2.cod_grau_academico=2 OR localoferta_ens_superior_matricula2.od_grau_academico=4') - .where('localoferta_ens_superior_matricula2.localoferta_cod_uf=41') .group('localoferta_ens_superior_matricula2.ano_censo') .order('localoferta_ens_superior_matricula2.ano_censo') next() -- GitLab From 9d4d0da1c9f2515aa8d9c286ecd6c83f6306b8bd Mon Sep 17 00:00:00 2001 From: godp21 <godp21@inf.ufpr.br> Date: Tue, 22 Mar 2022 11:04:07 -0300 Subject: [PATCH 27/40] adding console logs to test --- src/libs/routes/universityEnrollment.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libs/routes/universityEnrollment.js b/src/libs/routes/universityEnrollment.js index 913b6e66..7cf18474 100644 --- a/src/libs/routes/universityEnrollment.js +++ b/src/libs/routes/universityEnrollment.js @@ -750,14 +750,13 @@ universityEnrollmentApp.get('/enter_situation', rqf.parse(), (req, res, next) => .group('localoferta_ens_superior_matricula2.ano_censo') .order('localoferta_ens_superior_matricula2.ano_censo') next() -}, rqf.build(), query, (req, res, next) => { +}, rqf.build(), (req, res, next) => {console.log(req.sql.toString()); next()}, query, (req, res, next) => { for (var res of req.result){ res.cursando = Number(res.cursando); res.concluinte = Number(res.concluinte); res.evadido = Number(res.evadido); res.trancado = Number(res.trancado); } - next(); }, id2str.transform(), response('enterSituation')); module.exports = universityEnrollmentApp; -- GitLab From 77ab838b0a411666353785638fc5de8fa323b2cb Mon Sep 17 00:00:00 2001 From: godp21 <godp21@inf.ufpr.br> Date: Tue, 22 Mar 2022 11:08:27 -0300 Subject: [PATCH 28/40] definitive edition --- src/libs/routes/universityEnrollment.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/routes/universityEnrollment.js b/src/libs/routes/universityEnrollment.js index 7cf18474..4819a6e8 100644 --- a/src/libs/routes/universityEnrollment.js +++ b/src/libs/routes/universityEnrollment.js @@ -746,7 +746,7 @@ universityEnrollmentApp.get('/enter_situation', rqf.parse(), (req, res, next) => .field('COUNT(*)', 'total') .field('localoferta_ens_superior_matricula2.ano_censo') .where('localoferta_ens_superior_matricula2.cod_nivel_academico=1') - .where('localoferta_ens_superior_matricula2.cod_grau_academico=2 OR localoferta_ens_superior_matricula2.od_grau_academico=4') + .where('localoferta_ens_superior_matricula2.cod_grau_academico=2 OR localoferta_ens_superior_matricula2.cod_grau_academico=4') .group('localoferta_ens_superior_matricula2.ano_censo') .order('localoferta_ens_superior_matricula2.ano_censo') next() -- GitLab From ad2d5cba40934c83ce609961398cfff513c30363 Mon Sep 17 00:00:00 2001 From: godp21 <godp21@inf.ufpr.br> Date: Tue, 22 Mar 2022 11:14:13 -0300 Subject: [PATCH 29/40] fixing filters --- src/libs/routes/universityEnrollment.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/routes/universityEnrollment.js b/src/libs/routes/universityEnrollment.js index 4819a6e8..b4747a62 100644 --- a/src/libs/routes/universityEnrollment.js +++ b/src/libs/routes/universityEnrollment.js @@ -333,12 +333,12 @@ rqf.addField({ relation: '=', type: 'integer', field: 'localoferta_cod_uf', - table: 'localoferta_ens_superior_matricula' + table: 'localoferta_ens_superior_matricula2' }, join: { primary: 'id', foreign: 'localoferta_cod_uf', - foreignTable: 'localoferta_ens_superior_matricula' + foreignTable: 'localoferta_ens_superior_matricula2' } }).addValue({ name: 'region', -- GitLab From c31d96c717751a44b670fc8b09e2f8d6b3caca8e Mon Sep 17 00:00:00 2001 From: godp21 <godp21@inf.ufpr.br> Date: Tue, 22 Mar 2022 11:19:49 -0300 Subject: [PATCH 30/40] changing the consult table --- src/libs/routes/universityEnrollment.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/libs/routes/universityEnrollment.js b/src/libs/routes/universityEnrollment.js index b4747a62..bc51ee85 100644 --- a/src/libs/routes/universityEnrollment.js +++ b/src/libs/routes/universityEnrollment.js @@ -333,12 +333,12 @@ rqf.addField({ relation: '=', type: 'integer', field: 'localoferta_cod_uf', - table: 'localoferta_ens_superior_matricula2' + table: 'localoferta_ens_superior_matricula' }, join: { primary: 'id', foreign: 'localoferta_cod_uf', - foreignTable: 'localoferta_ens_superior_matricula2' + foreignTable: 'localoferta_ens_superior_matricula' } }).addValue({ name: 'region', @@ -738,17 +738,17 @@ universityEnrollmentApp.get('/', rqf.parse(), (req, res, next) => { }, response('universityEnrollment')); universityEnrollmentApp.get('/enter_situation', rqf.parse(), (req, res, next) => { - req.sql.from('localoferta_ens_superior_matricula2') - .field('SUM(CASE WHEN localoferta_ens_superior_matricula2.cod_aluno_situacao=2 AND localoferta_ens_superior_matricula2.ingressante=1 THEN 1 ELSE 0 END)', 'cursando') - .field('SUM(CASE WHEN localoferta_ens_superior_matricula2.cod_aluno_situacao=6 AND localoferta_ens_superior_matricula2.ingressante=1 THEN 1 ELSE 0 END)', 'concluinte') - .field('SUM(CASE WHEN (localoferta_ens_superior_matricula2.cod_aluno_situacao=4 OR localoferta_ens_superior_matricula2.cod_aluno_situacao=5 OR localoferta_ens_superior_matricula2.cod_aluno_situacao=7) AND localoferta_ens_superior_matricula2.ingressante=1 THEN 1 ELSE 0 END)', 'evadido') - .field('SUM(CASE WHEN localoferta_ens_superior_matricula2.cod_aluno_situacao=3 AND localoferta_ens_superior_matricula2.ingressante=1 THEN 1 ELSE 0 END)', 'trancado') + req.sql.from('localoferta_ens_superior_matricula') + .field('SUM(CASE WHEN localoferta_ens_superior_matricula.cod_aluno_situacao=2 AND localoferta_ens_superior_matricula.ingressante=1 THEN 1 ELSE 0 END)', 'cursando') + .field('SUM(CASE WHEN localoferta_ens_superior_matricula.cod_aluno_situacao=6 AND localoferta_ens_superior_matricula.ingressante=1 THEN 1 ELSE 0 END)', 'concluinte') + .field('SUM(CASE WHEN (localoferta_ens_superior_matricula.cod_aluno_situacao=4 OR localoferta_ens_superior_matricula.cod_aluno_situacao=5 OR localoferta_ens_superior_matricula.cod_aluno_situacao=7) AND localoferta_ens_superior_matricula.ingressante=1 THEN 1 ELSE 0 END)', 'evadido') + .field('SUM(CASE WHEN localoferta_ens_superior_matricula.cod_aluno_situacao=3 AND localoferta_ens_superior_matricula.ingressante=1 THEN 1 ELSE 0 END)', 'trancado') .field('COUNT(*)', 'total') - .field('localoferta_ens_superior_matricula2.ano_censo') - .where('localoferta_ens_superior_matricula2.cod_nivel_academico=1') - .where('localoferta_ens_superior_matricula2.cod_grau_academico=2 OR localoferta_ens_superior_matricula2.cod_grau_academico=4') - .group('localoferta_ens_superior_matricula2.ano_censo') - .order('localoferta_ens_superior_matricula2.ano_censo') + .field('localoferta_ens_superior_matricula.ano_censo') + .where('localoferta_ens_superior_matricula.cod_nivel_academico=1') + .where('localoferta_ens_superior_matricula.cod_grau_academico=2 OR localoferta_ens_superior_matricula.cod_grau_academico=4') + .group('localoferta_ens_superior_matricula.ano_censo') + .order('localoferta_ens_superior_matricula.ano_censo') next() }, rqf.build(), (req, res, next) => {console.log(req.sql.toString()); next()}, query, (req, res, next) => { for (var res of req.result){ -- GitLab From 20d265cf77ca5955072572f11b3dea9104475b48 Mon Sep 17 00:00:00 2001 From: godp21 <godp21@inf.ufpr.br> Date: Wed, 23 Mar 2022 09:32:20 -0300 Subject: [PATCH 31/40] added enrollment_situation sub-route on universityEnrollment route --- src/libs/routes/universityEnrollment.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/libs/routes/universityEnrollment.js b/src/libs/routes/universityEnrollment.js index bc51ee85..fb3e2e1f 100644 --- a/src/libs/routes/universityEnrollment.js +++ b/src/libs/routes/universityEnrollment.js @@ -760,3 +760,23 @@ universityEnrollmentApp.get('/enter_situation', rqf.parse(), (req, res, next) => next(); }, id2str.transform(), response('enterSituation')); module.exports = universityEnrollmentApp; +universityEnrollmentApp.get('/enrollment_situation', rqf.parse(), (req, res, next) => { + req.sql.from('localoferta_ens_superior_matricula') + .field('SUM(CASE WHEN localoferta_ens_superior_matricula.cod_aluno_situacao=2 AND localoferta_ens_superior_matricula.ingressante=1 THEN 1 ELSE 0 END)', 'ingressante') + .field('SUM(CASE WHEN localoferta_ens_superior_matricula.cod_aluno_situacao=2 AND localoferta_ens_superior_matricula.ingressante=0 AND localoferta_ens_superior_matricula.concluinte=0 THEN 1 ELSE 0 END)', 'cursando') + .field('SUM(localoferta_ens_superior_matricula.concluinte)', 'concluintes') + .field('SUM(CASE WHEN (localoferta_ens_superior_matricula.concluinte=1) OR (localoferta_ens_superior_matricula.cod_aluno_situacao = 2 and localoferta_ens_superior_matricula.ingressante = 0) OR (localoferta_ens_superior_matricula.cod_aluno_situacao = 2 and localoferta_ens_superior_matricula.ingressante = 1) THEN 1 ELSE 0 END)', 'total') + .field('localoferta_ens_superior_matricula.ano_censo') + .where('localoferta_ens_superior_matricula.cod_nivel_academico=1') + .where('localoferta_ens_superior_matricula.cod_grau_academico=2 OR localoferta_ens_superior_matricula.cod_grau_academico=4') + .group('localoferta_ens_superior_matricula.ano_censo') + .order('localoferta_ens_superior_matricula.ano_censo') + next() +}, rqf.build(), (req, res, next) => {console.log(req.sql.toString()); next()}, query, (req, res, next) => { + for (var res of req.result){ + res.ingressante = Number(res.ingressante); + res.cursando = Number(res.cursando); + res.concluintes = Number(res.concluintes); + } + next(); +}, id2str.transform(), response('enrollmentSituation')); \ No newline at end of file -- GitLab From b61446e09e3789d2fce40745b9cfe061ad66ec73 Mon Sep 17 00:00:00 2001 From: godp21 <godp21@inf.ufpr.br> Date: Wed, 23 Mar 2022 09:36:15 -0300 Subject: [PATCH 32/40] switched 'total' result to integer --- src/libs/routes/universityEnrollment.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libs/routes/universityEnrollment.js b/src/libs/routes/universityEnrollment.js index fb3e2e1f..eaea3215 100644 --- a/src/libs/routes/universityEnrollment.js +++ b/src/libs/routes/universityEnrollment.js @@ -777,6 +777,7 @@ universityEnrollmentApp.get('/enrollment_situation', rqf.parse(), (req, res, nex res.ingressante = Number(res.ingressante); res.cursando = Number(res.cursando); res.concluintes = Number(res.concluintes); + res.total = Number(res.total); } next(); }, id2str.transform(), response('enrollmentSituation')); \ No newline at end of file -- GitLab From 133d65d6a2e377869da72f6ccbebc8c55054f91b Mon Sep 17 00:00:00 2001 From: godp21 <godp21@inf.ufpr.br> Date: Wed, 23 Mar 2022 11:19:42 -0300 Subject: [PATCH 33/40] changing names of result --- src/libs/routes/universityEnrollment.js | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/libs/routes/universityEnrollment.js b/src/libs/routes/universityEnrollment.js index 5adec697..29a1d0f3 100644 --- a/src/libs/routes/universityEnrollment.js +++ b/src/libs/routes/universityEnrollment.js @@ -684,8 +684,6 @@ universityEnrollmentApp.get('/', rqf.parse(), (req, res, next) => { req.sql.from('localoferta_ens_superior_matricula') .field('curso_ens_superior.ano_censo', 'year') .field('COUNT(localoferta_ens_superior.cod_local_oferta)', 'total') - .where('localoferta_ens_superior_matricula.cod_aluno_situacao = 2 OR localoferta_ens_superior_matricula.cod_aluno_situacao = 6 OR localoferta_ens_superior_matricula.matriculado = 1') - .where('localoferta_ens_superior_matricula.cod_nivel_academico = 1') .group('localoferta_ens_superior_matricula.ano_censo') .order('localoferta_ens_superior_matricula.ano_censo') .order('localoferta_ens_superior.cod_local_oferta'); @@ -695,8 +693,6 @@ universityEnrollmentApp.get('/', rqf.parse(), (req, res, next) => { .field('COUNT(*)', 'total') .field('localoferta_ens_superior_matricula.cod_ies', 'university_id') .field('localoferta_ens_superior_matricula.nome_ies', 'university_name') - .where('localoferta_ens_superior_matricula.cod_aluno_situacao = 2 OR localoferta_ens_superior_matricula.cod_aluno_situacao = 6 OR localoferta_ens_superior_matricula.matriculado = 1') - .where('localoferta_ens_superior_matricula.cod_nivel_academico = 1') .group('localoferta_ens_superior_matricula.ano_censo') .group('localoferta_ens_superior_matricula.cod_ies') .group('localoferta_ens_superior_matricula.nome_ies') @@ -709,8 +705,6 @@ universityEnrollmentApp.get('/', rqf.parse(), (req, res, next) => { .field('DISTINCT COUNT(*)', 'total') .field("'Brasil'", 'name') .field('localoferta_ens_superior_matricula.ano_censo', 'year') - .where('localoferta_ens_superior_matricula.cod_aluno_situacao = 2 OR localoferta_ens_superior_matricula.cod_aluno_situacao = 6 OR localoferta_ens_superior_matricula.matriculado = 1') - .where('localoferta_ens_superior_matricula.cod_nivel_academico = 1') .group('localoferta_ens_superior_matricula.ano_censo') .order('localoferta_ens_superior_matricula.ano_censo') } else if ("university" in req.dims || "universityLocalOffer" in req.dims) { @@ -729,8 +723,6 @@ universityEnrollmentApp.get('/', rqf.parse(), (req, res, next) => { .field('COUNT(*)', 'total') .field("'Brasil'", 'name') .field('localoferta_ens_superior_matricula.ano_censo', 'year') - .where('localoferta_ens_superior_matricula.cod_aluno_situacao = 2 OR localoferta_ens_superior_matricula.cod_aluno_situacao = 6 OR localoferta_ens_superior_matricula.matriculado = 1') - .where('localoferta_ens_superior_matricula.cod_nivel_academico = 1') .group('localoferta_ens_superior_matricula.ano_censo') .order('localoferta_ens_superior_matricula.ano_censo') } @@ -752,7 +744,8 @@ universityEnrollmentApp.get('/enter_situation', rqf.parse(), (req, res, next) => .field('SUM(CASE WHEN (localoferta_ens_superior_matricula.cod_aluno_situacao=4 OR localoferta_ens_superior_matricula.cod_aluno_situacao=5 OR localoferta_ens_superior_matricula.cod_aluno_situacao=7) AND localoferta_ens_superior_matricula.ingressante=1 THEN 1 ELSE 0 END)', 'evadido') .field('SUM(CASE WHEN localoferta_ens_superior_matricula.cod_aluno_situacao=3 AND localoferta_ens_superior_matricula.ingressante=1 THEN 1 ELSE 0 END)', 'trancado') .field('COUNT(*)', 'total') - .field('localoferta_ens_superior_matricula.ano_censo') + .field("'Brasil'", 'name') + .field('localoferta_ens_superior_matricula.ano_censo', 'year') .where('localoferta_ens_superior_matricula.cod_nivel_academico=1') .where('localoferta_ens_superior_matricula.cod_grau_academico=2 OR localoferta_ens_superior_matricula.cod_grau_academico=4') .group('localoferta_ens_superior_matricula.ano_censo') @@ -774,7 +767,8 @@ universityEnrollmentApp.get('/enrollment_situation', rqf.parse(), (req, res, nex .field('SUM(CASE WHEN localoferta_ens_superior_matricula.cod_aluno_situacao=2 AND localoferta_ens_superior_matricula.ingressante=0 AND localoferta_ens_superior_matricula.concluinte=0 THEN 1 ELSE 0 END)', 'cursando') .field('SUM(localoferta_ens_superior_matricula.concluinte)', 'concluintes') .field('SUM(CASE WHEN (localoferta_ens_superior_matricula.concluinte=1) OR (localoferta_ens_superior_matricula.cod_aluno_situacao = 2 and localoferta_ens_superior_matricula.ingressante = 0) OR (localoferta_ens_superior_matricula.cod_aluno_situacao = 2 and localoferta_ens_superior_matricula.ingressante = 1) THEN 1 ELSE 0 END)', 'total') - .field('localoferta_ens_superior_matricula.ano_censo') + .field('localoferta_ens_superior_matricula.ano_censo', 'year') + .field("'Brasil'", 'name') .where('localoferta_ens_superior_matricula.cod_nivel_academico=1') .where('localoferta_ens_superior_matricula.cod_grau_academico=2 OR localoferta_ens_superior_matricula.cod_grau_academico=4') .group('localoferta_ens_superior_matricula.ano_censo') @@ -788,4 +782,5 @@ universityEnrollmentApp.get('/enrollment_situation', rqf.parse(), (req, res, nex res.total = Number(res.total); } next(); -}, id2str.transform(), response('enrollmentSituation')); \ No newline at end of file +}, id2str.transform(), response('enrollmentSituation')); + -- GitLab From ac780e088161a59e56d4930ec58238e63e84ba0c Mon Sep 17 00:00:00 2001 From: Pietro <ppc19@inf.ufpr.br> Date: Wed, 23 Mar 2022 11:24:24 -0300 Subject: [PATCH 34/40] add filters to old route --- src/libs/routes/universityEnrollment.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libs/routes/universityEnrollment.js b/src/libs/routes/universityEnrollment.js index eaea3215..5adec697 100644 --- a/src/libs/routes/universityEnrollment.js +++ b/src/libs/routes/universityEnrollment.js @@ -684,6 +684,8 @@ universityEnrollmentApp.get('/', rqf.parse(), (req, res, next) => { req.sql.from('localoferta_ens_superior_matricula') .field('curso_ens_superior.ano_censo', 'year') .field('COUNT(localoferta_ens_superior.cod_local_oferta)', 'total') + .where('localoferta_ens_superior_matricula.cod_aluno_situacao = 2 OR localoferta_ens_superior_matricula.cod_aluno_situacao = 6 OR localoferta_ens_superior_matricula.matriculado = 1') + .where('localoferta_ens_superior_matricula.cod_nivel_academico = 1') .group('localoferta_ens_superior_matricula.ano_censo') .order('localoferta_ens_superior_matricula.ano_censo') .order('localoferta_ens_superior.cod_local_oferta'); @@ -693,6 +695,8 @@ universityEnrollmentApp.get('/', rqf.parse(), (req, res, next) => { .field('COUNT(*)', 'total') .field('localoferta_ens_superior_matricula.cod_ies', 'university_id') .field('localoferta_ens_superior_matricula.nome_ies', 'university_name') + .where('localoferta_ens_superior_matricula.cod_aluno_situacao = 2 OR localoferta_ens_superior_matricula.cod_aluno_situacao = 6 OR localoferta_ens_superior_matricula.matriculado = 1') + .where('localoferta_ens_superior_matricula.cod_nivel_academico = 1') .group('localoferta_ens_superior_matricula.ano_censo') .group('localoferta_ens_superior_matricula.cod_ies') .group('localoferta_ens_superior_matricula.nome_ies') @@ -705,6 +709,8 @@ universityEnrollmentApp.get('/', rqf.parse(), (req, res, next) => { .field('DISTINCT COUNT(*)', 'total') .field("'Brasil'", 'name') .field('localoferta_ens_superior_matricula.ano_censo', 'year') + .where('localoferta_ens_superior_matricula.cod_aluno_situacao = 2 OR localoferta_ens_superior_matricula.cod_aluno_situacao = 6 OR localoferta_ens_superior_matricula.matriculado = 1') + .where('localoferta_ens_superior_matricula.cod_nivel_academico = 1') .group('localoferta_ens_superior_matricula.ano_censo') .order('localoferta_ens_superior_matricula.ano_censo') } else if ("university" in req.dims || "universityLocalOffer" in req.dims) { @@ -723,6 +729,8 @@ universityEnrollmentApp.get('/', rqf.parse(), (req, res, next) => { .field('COUNT(*)', 'total') .field("'Brasil'", 'name') .field('localoferta_ens_superior_matricula.ano_censo', 'year') + .where('localoferta_ens_superior_matricula.cod_aluno_situacao = 2 OR localoferta_ens_superior_matricula.cod_aluno_situacao = 6 OR localoferta_ens_superior_matricula.matriculado = 1') + .where('localoferta_ens_superior_matricula.cod_nivel_academico = 1') .group('localoferta_ens_superior_matricula.ano_censo') .order('localoferta_ens_superior_matricula.ano_censo') } -- GitLab From 9e8a187c4e83477914a07dc1aa45e72978479f16 Mon Sep 17 00:00:00 2001 From: Pietro <ppc19@inf.ufpr.br> Date: Wed, 23 Mar 2022 11:54:49 -0300 Subject: [PATCH 35/40] add subroutes --- src/libs/convert/enrollmentSituation.js | 33 +++++++++++++++++++++++ src/libs/convert/enterSituation.js | 35 +++++++++++++++++++++++++ src/libs/middlewares/id2str.js | 10 +++++-- src/libs/routes/universityEnrollment.js | 24 +++++++++++++++++ 4 files changed, 100 insertions(+), 2 deletions(-) create mode 100644 src/libs/convert/enrollmentSituation.js create mode 100644 src/libs/convert/enterSituation.js diff --git a/src/libs/convert/enrollmentSituation.js b/src/libs/convert/enrollmentSituation.js new file mode 100644 index 00000000..9b709ea2 --- /dev/null +++ b/src/libs/convert/enrollmentSituation.js @@ -0,0 +1,33 @@ +/* +Copyright (C) 2022 Centro de Computacao Cientifica e Software Livre +Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR + +This file is part of simcaq-node. + +simcaq-node is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +simcaq-node is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with simcaq-node. If not, see <https://www.gnu.org/licenses/>. +*/ + +module.exports = function enrollmentSituation(id) { + switch (id) { + case 1: + return 'Ingressante'; + case 2: + return 'Cursando'; + case 3: + return 'Concluintes'; + default: + return 'Não definido'; + } +}; + diff --git a/src/libs/convert/enterSituation.js b/src/libs/convert/enterSituation.js new file mode 100644 index 00000000..1fe551d9 --- /dev/null +++ b/src/libs/convert/enterSituation.js @@ -0,0 +1,35 @@ +/* +Copyright (C) 2022 Centro de Computacao Cientifica e Software Livre +Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR + +This file is part of simcaq-node. + +simcaq-node is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +simcaq-node is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with simcaq-node. If not, see <https://www.gnu.org/licenses/>. +*/ + +module.exports = function enterSituation(id) { + switch (id) { + case 1: + return 'Cursando'; + case 2: + return 'Concluinte'; + case 3: + return 'Evadido'; + case 4: + return 'Trancado'; + default: + return 'Não definido'; + } +}; + diff --git a/src/libs/middlewares/id2str.js b/src/libs/middlewares/id2str.js index fa6a20ca..668faa80 100644 --- a/src/libs/middlewares/id2str.js +++ b/src/libs/middlewares/id2str.js @@ -90,6 +90,8 @@ const initialTraining = require(`${libs}/convert/initialTraining`); const posTraining = require(`${libs}/convert/posTraining`); const licentiateDegree = require(`${libs}/convert/licentiateDegree`); const enrolledVacanciesFreshmen = require(`${libs}/convert/enrolledVacanciesFreshmen`); +const enterSituation = require(`${libs}/convert/enterSituation`); +const enrollmentSituation = require(`${libs}/convert/enrollmentSituation`); const ids = { gender_id: gender, @@ -171,7 +173,9 @@ const ids = { initial_training_id: initialTraining, pos_training_id: posTraining, licentiate_degree_id: licentiateDegree, - enrolled_vacancies_freshmen: enrolledVacanciesFreshmen + enrolled_vacancies_freshmen: enrolledVacanciesFreshmen, + enter_situation: enterSituation, + enrollment_situation: enrollmentSituation }; function transform(removeId=false) { @@ -280,5 +284,7 @@ module.exports = { initialTraining, posTraining, licentiateDegree, - enrolledVacanciesFreshmen + enrolledVacanciesFreshmen, + enterSituation, + enrollmentSituation }; diff --git a/src/libs/routes/universityEnrollment.js b/src/libs/routes/universityEnrollment.js index 5adec697..d68166c3 100644 --- a/src/libs/routes/universityEnrollment.js +++ b/src/libs/routes/universityEnrollment.js @@ -286,6 +286,30 @@ universityEnrollmentApp.get('/age_student_code', function (req, res, next) { next(); }, response('age_student_code')); + +universityEnrollmentApp.get('/student_enter_situation', function (req, res, next) { + req.result = []; + for (var i = 1; i <= 4; ++i) { + req.result.push({ + id: i, + name: id2str.enterSituation(i) + }); + }; + next(); +}, response('student_enter_situation')); + + +universityEnrollmentApp.get('/student_enrollment_situation', function (req, res, next) { + req.result = []; + for (var i = 1; i <= 3; ++i) { + req.result.push({ + id: i, + name: id2str.enrollmentSituation(i) + }); + }; + next(); +}, response('student_enrollment_situation')); + universityEnrollmentApp.get('/university', (req, res, next) => { req.sql.from('aluno_ens_superior') .field('DISTINCT aluno_ens_superior.nome_ies', 'nome') -- GitLab From 5324f1d990c4c0dca6b8036a41722afa51650008 Mon Sep 17 00:00:00 2001 From: Miguel Salerno <mans17@inf.ufpr.br> Date: Fri, 25 Mar 2022 09:43:00 -0300 Subject: [PATCH 36/40] change dim to subroute --- src/libs/routes/universityEnrollment.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/routes/universityEnrollment.js b/src/libs/routes/universityEnrollment.js index a856f82d..5bded40f 100644 --- a/src/libs/routes/universityEnrollment.js +++ b/src/libs/routes/universityEnrollment.js @@ -287,7 +287,7 @@ universityEnrollmentApp.get('/age_student_code', function (req, res, next) { }, response('age_student_code')); -universityEnrollmentApp.get('/student_enter_situation', function (req, res, next) { +universityEnrollmentApp.get('/enter_situation/student_enter_situation', function (req, res, next) { req.result = []; for (var i = 1; i <= 4; ++i) { req.result.push({ @@ -299,7 +299,7 @@ universityEnrollmentApp.get('/student_enter_situation', function (req, res, next }, response('student_enter_situation')); -universityEnrollmentApp.get('/student_enrollment_situation', function (req, res, next) { +universityEnrollmentApp.get('/enter_situation/student_enrollment_situation', function (req, res, next) { req.result = []; for (var i = 1; i <= 3; ++i) { req.result.push({ -- GitLab From bb1b25e38bf9408bbf38a5464298ff04c10e0b94 Mon Sep 17 00:00:00 2001 From: Pietro <ppc19@inf.ufpr.br> Date: Wed, 30 Mar 2022 09:35:13 -0300 Subject: [PATCH 37/40] hotfix add taxa_evasao --- src/libs/routes/universityEnrollment.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libs/routes/universityEnrollment.js b/src/libs/routes/universityEnrollment.js index a856f82d..f39d9f81 100644 --- a/src/libs/routes/universityEnrollment.js +++ b/src/libs/routes/universityEnrollment.js @@ -781,10 +781,12 @@ universityEnrollmentApp.get('/enter_situation', rqf.parse(), (req, res, next) => res.concluinte = Number(res.concluinte); res.evadido = Number(res.evadido); res.trancado = Number(res.trancado); + res.total = res.cursando + res.concluinte + res.evadido + res.trancado + res.taxa_evasao = Number(res.evadido/res.total) } next(); }, id2str.transform(), response('enterSituation')); -module.exports = universityEnrollmentApp; + universityEnrollmentApp.get('/enrollment_situation', rqf.parse(), (req, res, next) => { req.sql.from('localoferta_ens_superior_matricula') .field('SUM(CASE WHEN localoferta_ens_superior_matricula.cod_aluno_situacao=2 AND localoferta_ens_superior_matricula.ingressante=1 THEN 1 ELSE 0 END)', 'ingressante') @@ -808,3 +810,5 @@ universityEnrollmentApp.get('/enrollment_situation', rqf.parse(), (req, res, nex next(); }, id2str.transform(), response('enrollmentSituation')); + +module.exports = universityEnrollmentApp; \ No newline at end of file -- GitLab From c9d54cfcc399000b5e8cbfcda0207291dab6fa80 Mon Sep 17 00:00:00 2001 From: Pietro <ppc19@inf.ufpr.br> Date: Wed, 30 Mar 2022 09:48:55 -0300 Subject: [PATCH 38/40] hotfix percentage --- src/libs/routes/universityEnrollment.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/routes/universityEnrollment.js b/src/libs/routes/universityEnrollment.js index 329bfff2..262ac88f 100644 --- a/src/libs/routes/universityEnrollment.js +++ b/src/libs/routes/universityEnrollment.js @@ -782,7 +782,7 @@ universityEnrollmentApp.get('/enter_situation', rqf.parse(), (req, res, next) => res.evadido = Number(res.evadido); res.trancado = Number(res.trancado); res.total = res.cursando + res.concluinte + res.evadido + res.trancado - res.taxa_evasao = Number(res.evadido/res.total) + res.taxa_evasao = Number( ((res.evadido/res.total) * 100).toFixed(2) ) } next(); }, id2str.transform(), response('enterSituation')); -- GitLab From 45d8249e5a374dde3d2a67cab6bdee699b72ece6 Mon Sep 17 00:00:00 2001 From: Pietro <ppc19@inf.ufpr.br> Date: Tue, 5 Apr 2022 10:23:22 -0300 Subject: [PATCH 39/40] hotfix filters --- src/libs/routes/universityEnrollment.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libs/routes/universityEnrollment.js b/src/libs/routes/universityEnrollment.js index 262ac88f..81f53808 100644 --- a/src/libs/routes/universityEnrollment.js +++ b/src/libs/routes/universityEnrollment.js @@ -709,6 +709,8 @@ universityEnrollmentApp.get('/', rqf.parse(), (req, res, next) => { .field('curso_ens_superior.ano_censo', 'year') .field('COUNT(localoferta_ens_superior.cod_local_oferta)', 'total') .group('localoferta_ens_superior_matricula.ano_censo') + .where('localoferta_ens_superior_matricula.cod_nivel_academico=1') + .where('localoferta_ens_superior_matricula.cod_grau_academico=2 OR localoferta_ens_superior_matricula.cod_grau_academico=4') .order('localoferta_ens_superior_matricula.ano_censo') .order('localoferta_ens_superior.cod_local_oferta'); } else { @@ -720,6 +722,8 @@ universityEnrollmentApp.get('/', rqf.parse(), (req, res, next) => { .group('localoferta_ens_superior_matricula.ano_censo') .group('localoferta_ens_superior_matricula.cod_ies') .group('localoferta_ens_superior_matricula.nome_ies') + .where('localoferta_ens_superior_matricula.cod_nivel_academico=1') + .where('localoferta_ens_superior_matricula.cod_grau_academico=2 OR localoferta_ens_superior_matricula.cod_grau_academico=4') .order('localoferta_ens_superior_matricula.ano_censo') .order('localoferta_ens_superior_matricula.cod_local_oferta'); } @@ -729,6 +733,8 @@ universityEnrollmentApp.get('/', rqf.parse(), (req, res, next) => { .field('DISTINCT COUNT(*)', 'total') .field("'Brasil'", 'name') .field('localoferta_ens_superior_matricula.ano_censo', 'year') + .where('localoferta_ens_superior_matricula.cod_nivel_academico=1') + .where('localoferta_ens_superior_matricula.cod_grau_academico=2 OR localoferta_ens_superior_matricula.cod_grau_academico=4') .group('localoferta_ens_superior_matricula.ano_censo') .order('localoferta_ens_superior_matricula.ano_censo') } else if ("university" in req.dims || "universityLocalOffer" in req.dims) { @@ -747,6 +753,8 @@ universityEnrollmentApp.get('/', rqf.parse(), (req, res, next) => { .field('COUNT(*)', 'total') .field("'Brasil'", 'name') .field('localoferta_ens_superior_matricula.ano_censo', 'year') + .where('localoferta_ens_superior_matricula.cod_nivel_academico=1') + .where('localoferta_ens_superior_matricula.cod_grau_academico=2 OR localoferta_ens_superior_matricula.cod_grau_academico=4') .group('localoferta_ens_superior_matricula.ano_censo') .order('localoferta_ens_superior_matricula.ano_censo') } -- GitLab From 51b5589402d6ccb2c57a01bd7205a14fb4f7be59 Mon Sep 17 00:00:00 2001 From: Pietro <ppc19@inf.ufpr.br> Date: Tue, 5 Apr 2022 11:25:09 -0300 Subject: [PATCH 40/40] hotfix filters --- src/libs/routes/universityEnrollment.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/libs/routes/universityEnrollment.js b/src/libs/routes/universityEnrollment.js index 81f53808..6d1a08f1 100644 --- a/src/libs/routes/universityEnrollment.js +++ b/src/libs/routes/universityEnrollment.js @@ -709,8 +709,8 @@ universityEnrollmentApp.get('/', rqf.parse(), (req, res, next) => { .field('curso_ens_superior.ano_censo', 'year') .field('COUNT(localoferta_ens_superior.cod_local_oferta)', 'total') .group('localoferta_ens_superior_matricula.ano_censo') - .where('localoferta_ens_superior_matricula.cod_nivel_academico=1') - .where('localoferta_ens_superior_matricula.cod_grau_academico=2 OR localoferta_ens_superior_matricula.cod_grau_academico=4') + .where('localoferta_ens_superior_matricula.cod_aluno_situacao = 2 OR localoferta_ens_superior_matricula.cod_aluno_situacao = 6 OR localoferta_ens_superior_matricula.matriculado = 1') + .where('localoferta_ens_superior_matricula.cod_nivel_academico = 1') .order('localoferta_ens_superior_matricula.ano_censo') .order('localoferta_ens_superior.cod_local_oferta'); } else { @@ -722,8 +722,8 @@ universityEnrollmentApp.get('/', rqf.parse(), (req, res, next) => { .group('localoferta_ens_superior_matricula.ano_censo') .group('localoferta_ens_superior_matricula.cod_ies') .group('localoferta_ens_superior_matricula.nome_ies') - .where('localoferta_ens_superior_matricula.cod_nivel_academico=1') - .where('localoferta_ens_superior_matricula.cod_grau_academico=2 OR localoferta_ens_superior_matricula.cod_grau_academico=4') + .where('localoferta_ens_superior_matricula.cod_aluno_situacao = 2 OR localoferta_ens_superior_matricula.cod_aluno_situacao = 6 OR localoferta_ens_superior_matricula.matriculado = 1') + .where('localoferta_ens_superior_matricula.cod_nivel_academico = 1') .order('localoferta_ens_superior_matricula.ano_censo') .order('localoferta_ens_superior_matricula.cod_local_oferta'); } @@ -733,8 +733,8 @@ universityEnrollmentApp.get('/', rqf.parse(), (req, res, next) => { .field('DISTINCT COUNT(*)', 'total') .field("'Brasil'", 'name') .field('localoferta_ens_superior_matricula.ano_censo', 'year') - .where('localoferta_ens_superior_matricula.cod_nivel_academico=1') - .where('localoferta_ens_superior_matricula.cod_grau_academico=2 OR localoferta_ens_superior_matricula.cod_grau_academico=4') + .where('localoferta_ens_superior_matricula.cod_aluno_situacao = 2 OR localoferta_ens_superior_matricula.cod_aluno_situacao = 6 OR localoferta_ens_superior_matricula.matriculado = 1') + .where('localoferta_ens_superior_matricula.cod_nivel_academico = 1') .group('localoferta_ens_superior_matricula.ano_censo') .order('localoferta_ens_superior_matricula.ano_censo') } else if ("university" in req.dims || "universityLocalOffer" in req.dims) { @@ -753,8 +753,8 @@ universityEnrollmentApp.get('/', rqf.parse(), (req, res, next) => { .field('COUNT(*)', 'total') .field("'Brasil'", 'name') .field('localoferta_ens_superior_matricula.ano_censo', 'year') - .where('localoferta_ens_superior_matricula.cod_nivel_academico=1') - .where('localoferta_ens_superior_matricula.cod_grau_academico=2 OR localoferta_ens_superior_matricula.cod_grau_academico=4') + .where('localoferta_ens_superior_matricula.cod_aluno_situacao = 2 OR localoferta_ens_superior_matricula.cod_aluno_situacao = 6 OR localoferta_ens_superior_matricula.matriculado = 1') + .where('localoferta_ens_superior_matricula.cod_nivel_academico = 1') .group('localoferta_ens_superior_matricula.ano_censo') .order('localoferta_ens_superior_matricula.ano_censo') } @@ -766,7 +766,7 @@ universityEnrollmentApp.get('/', rqf.parse(), (req, res, next) => { course.percentage = Number((( course.total / total_course ) * 100).toFixed(2)) } } - next() + next(); }, response('universityEnrollment')); universityEnrollmentApp.get('/enter_situation', rqf.parse(), (req, res, next) => { -- GitLab