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/class.js b/src/libs/routes/class.js index 4cf349fa06672f1fbe927ddd4f424a9d4edb0844..88df17a2dc937ab7ac92bd80fc642cc431dc6384 100644 --- a/src/libs/routes/class.js +++ b/src/libs/routes/class.js @@ -275,6 +275,16 @@ rqfCount.addField({ type: 'integer', field: 'localizacao_id' } +}).addValue({ + name: 'diff_location', + table: 'turma', + tableField: 'localizacao_diferenciada_par', + resultField: 'diff_location_id_par', + where: { + relation: '=', + type: 'integer', + field: 'localizacao_diferenciada_par' + } }).addValue({ name: 'rural_location', table: 'turma', diff --git a/src/libs/routes/employees.js b/src/libs/routes/employees.js index 89b5ebd090ebcf0d83c536bd2ee05eded98015e3..20dcb7b26195ad6ccb0d662a96c70b269a05acb1 100644 --- a/src/libs/routes/employees.js +++ b/src/libs/routes/employees.js @@ -253,6 +253,16 @@ rqfSchool.addField({ type: 'integer', field: 'localizacao_id' } +}).addValue({ + name: 'diff_location', + table: '@', + tableField: 'localizacao_diferenciada_par', + resultField: 'diff_location_id_par', + where: { + relation: '=', + type: 'integer', + field: 'localizacao_diferenciada_par' + } }).addValue({ name: 'rural_location', table: '@', diff --git a/src/libs/routes/enrollment.js b/src/libs/routes/enrollment.js index c3a1e68d3d2ab0aae30bd37a120ec489d1d09439..e0da7fbf7f4e51d7a69da0c1a1f0a45b3d0b1cec 100644 --- a/src/libs/routes/enrollment.js +++ b/src/libs/routes/enrollment.js @@ -498,6 +498,16 @@ rqf.addField({ type: 'integer', field: 'localizacao_id' } +}).addValue({ + name: 'diff_location', + table: 'matricula', + tableField: 'localizacao_diferenciada_par', + resultField: 'diff_location_id_par', + where: { + relation: '=', + type: 'integer', + field: 'localizacao_diferenciada_par' + } }).addValue({ name: 'rural_location', table: 'matricula', diff --git a/src/libs/routes/school.js b/src/libs/routes/school.js index e8527400e69d59adab330363ed8da1383b694184..eb521f6bc9444f0c34d71d3eda4263a4b98b01d8 100644 --- a/src/libs/routes/school.js +++ b/src/libs/routes/school.js @@ -58,14 +58,12 @@ schoolApp.get('/location', cache('15 day'), (req, res, next) => { next(); }, response('location')); -schoolApp.get('/rural_location', cache('15 day'), (req, res, next) => { +schoolApp.get('/diff_location', cache('15 day'), (req, res, next) => { req.result = [ - {id: 1, name: "Urbana"}, - {id: 2, name: "Rural"}, - {id: 3, name: "Rural - Ãrea de assentamento"}, - {id: 4, name: "Rural - Terra indÃgena"}, - {id: 5, name: "Rural - Ãrea remanescente de quilombos"}, - {id: 6, name: "Rural - Unidade de uso sustentável"} + {id: 0, name: "A escola não está em localidade diferenciada"}, + {id: 1, name: "Ãrea de assentamento"}, + {id: 2, name: "Terra indÃgena"}, + {id: 3, name: "Terra remanescente de quilombos"}, ]; next(); }, response('rural_location')); @@ -294,7 +292,17 @@ rqf.addField({ foreign: 'estado_id', foreignTable: 'escola' } -}, 'search'); +}, 'search').addValue({ + name: 'diff_location', + table: 'escola', + tableField: 'localizacao_diferenciada_par', + resultField: 'diff_location_id_par', + where: { + relation: '=', + type: 'integer', + field: 'localizacao_diferenciada_par' + } +}); rqfCount.addField({ name: 'filter', @@ -429,6 +437,16 @@ rqfCount.addField({ type: 'integer', field: 'localizacao_id' } +}).addValue({ + name: 'diff_location', + table: 'escola', + tableField: 'localizacao_diferenciada_par', + resultField: 'diff_location_id_par', + where: { + relation: '=', + type: 'integer', + field: 'localizacao_diferenciada_par' + } }).addValue({ name: 'rural_location', table: 'escola', diff --git a/src/libs/routes/teacher.js b/src/libs/routes/teacher.js index 51e5fea4be860ef25364252286fca143a59e921c..05f312228e255863cfe33728ca649891c7322af4 100644 --- a/src/libs/routes/teacher.js +++ b/src/libs/routes/teacher.js @@ -416,6 +416,16 @@ rqf.addField({ type: 'integer', field: 'localizacao_id' } +}).addValue({ + name: 'diff_location', + table: 'docente', + tableField: 'localizacao_diferenciada_par', + resultField: 'diff_location_id_par', + where: { + relation: '=', + type: 'integer', + field: 'localizacao_diferenciada_par' + } }).addValue({ name: 'rural_location', table: 'docente', @@ -522,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 6d1a08f197e8b140084fafe90f38f8756c8595c2..b58d923b9fe93e6f2345e3fa186ffb233d3fb903 100644 --- a/src/libs/routes/universityEnrollment.js +++ b/src/libs/routes/universityEnrollment.js @@ -298,6 +298,17 @@ universityEnrollmentApp.get('/enter_situation/student_enter_situation', function 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('/enter_situation/student_enrollment_situation', function (req, res, next) { req.result = []; @@ -797,10 +808,10 @@ universityEnrollmentApp.get('/enter_situation', rqf.parse(), (req, res, next) => 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') @@ -810,10 +821,11 @@ 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'));