Skip to content
Snippets Groups Projects
Commit 28149f4c authored by Pietro Cavassin's avatar Pietro Cavassin
Browse files

Merge branch 'enrollment_situation_tmp' into homologa

parents d5a7ff9a 8be665ba
No related branches found
No related tags found
3 merge requests!309Merge new updates into master,!279Homologa,!278Enrollment situation tmp
Pipeline #28166 failed
/*
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';
}
};
/*
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';
}
};
...@@ -90,6 +90,8 @@ const initialTraining = require(`${libs}/convert/initialTraining`); ...@@ -90,6 +90,8 @@ const initialTraining = require(`${libs}/convert/initialTraining`);
const posTraining = require(`${libs}/convert/posTraining`); const posTraining = require(`${libs}/convert/posTraining`);
const licentiateDegree = require(`${libs}/convert/licentiateDegree`); const licentiateDegree = require(`${libs}/convert/licentiateDegree`);
const enrolledVacanciesFreshmen = require(`${libs}/convert/enrolledVacanciesFreshmen`); const enrolledVacanciesFreshmen = require(`${libs}/convert/enrolledVacanciesFreshmen`);
const enterSituation = require(`${libs}/convert/enterSituation`);
const enrollmentSituation = require(`${libs}/convert/enrollmentSituation`);
const ids = { const ids = {
gender_id: gender, gender_id: gender,
...@@ -171,7 +173,9 @@ const ids = { ...@@ -171,7 +173,9 @@ const ids = {
initial_training_id: initialTraining, initial_training_id: initialTraining,
pos_training_id: posTraining, pos_training_id: posTraining,
licentiate_degree_id: licentiateDegree, licentiate_degree_id: licentiateDegree,
enrolled_vacancies_freshmen: enrolledVacanciesFreshmen enrolled_vacancies_freshmen: enrolledVacanciesFreshmen,
enter_situation: enterSituation,
enrollment_situation: enrollmentSituation
}; };
function transform(removeId=false) { function transform(removeId=false) {
...@@ -280,5 +284,7 @@ module.exports = { ...@@ -280,5 +284,7 @@ module.exports = {
initialTraining, initialTraining,
posTraining, posTraining,
licentiateDegree, licentiateDegree,
enrolledVacanciesFreshmen enrolledVacanciesFreshmen,
enterSituation,
enrollmentSituation
}; };
...@@ -286,6 +286,30 @@ universityEnrollmentApp.get('/age_student_code', function (req, res, next) { ...@@ -286,6 +286,30 @@ universityEnrollmentApp.get('/age_student_code', function (req, res, next) {
next(); next();
}, response('age_student_code')); }, 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) => { universityEnrollmentApp.get('/university', (req, res, next) => {
req.sql.from('aluno_ens_superior') req.sql.from('aluno_ens_superior')
.field('DISTINCT aluno_ens_superior.nome_ies', 'nome') .field('DISTINCT aluno_ens_superior.nome_ies', 'nome')
...@@ -737,4 +761,50 @@ universityEnrollmentApp.get('/', rqf.parse(), (req, res, next) => { ...@@ -737,4 +761,50 @@ universityEnrollmentApp.get('/', rqf.parse(), (req, res, next) => {
next() next()
}, response('universityEnrollment')); }, response('universityEnrollment'));
universityEnrollmentApp.get('/enter_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)', '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("'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')
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; 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', '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')
.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);
res.total = Number(res.total);
}
next();
}, id2str.transform(), response('enrollmentSituation'));
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment