diff --git a/src/libs/routes/auxiliar.js b/src/libs/routes/auxiliar.js index 5a4198d32bb0bfb55d996bd7e6b363ec6dd69436..08a910e5f6b44b53d1d2fca1bc3f47bf065ef015 100644 --- a/src/libs/routes/auxiliar.js +++ b/src/libs/routes/auxiliar.js @@ -370,7 +370,7 @@ auxiliarApp.get('/', rqf.parse(), (req, res, next) => { .where('(docente.tipo_docente = 2) AND \ ((docente.tipo_turma_id >= 0 AND docente.tipo_turma_id <= 3 AND docente.tipo_turma_atendimento_id is NULL) \ OR ((docente.tipo_turma_atendimento_id = 1 OR docente.tipo_turma_atendimento_id = 2) AND docente.tipo_turma_id is NULL)) \ - AND (docente.ano_censo <> 2009 or docente.escola_estado_id <> 42)'); // não devemos trazer SC em 2009. + AND (docente.ano_censo <> 2009 or (docente.escola_estado_id <> 42 AND docente.escola_estado_id <> 43))'); // não devemos trazer SC em 2009. next(); }, rqf.build(), query, addMissing(rqf), id2str.transform(), response('auxiliar')); diff --git a/src/libs/routes/teacher.js b/src/libs/routes/teacher.js index 2ce663284b0ceced90a6e2274b3857273e334bc1..05f312228e255863cfe33728ca649891c7322af4 100644 --- a/src/libs/routes/teacher.js +++ b/src/libs/routes/teacher.js @@ -532,7 +532,7 @@ teacherApp.get('/', rqf.parse(), (req, res, next) => { .where('(docente.tipo_docente = 1 OR docente.tipo_docente = 5) AND \ ((docente.tipo_turma_id >= 0 AND docente.tipo_turma_id <= 3 AND docente.tipo_turma_atendimento_id is NULL) \ OR ((docente.tipo_turma_atendimento_id = 1 OR docente.tipo_turma_atendimento_id = 2) AND docente.tipo_turma_id is NULL)) \ - AND (docente.ano_censo <> 2009 or docente.escola_estado_id <> 42)'); // não devemos trazer SC em 2009. + AND (docente.ano_censo <> 2009 or (docente.escola_estado_id <> 42 and docente.escola_estado_id <> 43) )'); // não devemos trazer SC em 2009. // if("education_level_mod" in req.dims) { // req.hadEducationLevelMod = true; diff --git a/src/libs/routes/universityEnrollment.js b/src/libs/routes/universityEnrollment.js index a856f82d3abb66a93618efc81a1ba1f08d98370a..b58d923b9fe93e6f2345e3fa186ffb233d3fb903 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({ @@ -298,8 +298,19 @@ universityEnrollmentApp.get('/student_enter_situation', function (req, res, next next(); }, response('student_enter_situation')); +universityEnrollmentApp.get('/enrollment_situation/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) { + +universityEnrollmentApp.get('/enter_situation/student_enrollment_situation', function (req, res, next) { req.result = []; for (var i = 1; i <= 3; ++i) { req.result.push({ @@ -709,6 +720,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_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 { @@ -720,6 +733,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_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'); } @@ -729,6 +744,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) { @@ -747,6 +764,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') } @@ -758,7 +777,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) => { @@ -781,16 +800,18 @@ 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) * 100).toFixed(2) ) } 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('SUM(CASE WHEN localoferta_ens_superior_matricula.cod_aluno_situacao=2 THEN 1 ELSE 0 END)', 'cursando') + .field('SUM(CASE WHEN localoferta_ens_superior_matricula.cod_aluno_situacao=6 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) THEN 1 ELSE 0 END)', 'evadido') + .field('SUM(CASE WHEN localoferta_ens_superior_matricula.cod_aluno_situacao=3 THEN 1 ELSE 0 END)', 'trancado') .field('localoferta_ens_superior_matricula.ano_censo', 'year') .field("'Brasil'", 'name') .where('localoferta_ens_superior_matricula.cod_nivel_academico=1') @@ -800,11 +821,14 @@ universityEnrollmentApp.get('/enrollment_situation', rqf.parse(), (req, res, nex 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); + 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 } next(); }, id2str.transform(), response('enrollmentSituation')); + +module.exports = universityEnrollmentApp; \ No newline at end of file