Commit bde20d7f authored by jpko19's avatar jpko19
Browse files

Merge branch 'dev' of gitlab.c3sl.ufpr.br:simcaq/simcaq-node into dev

parents b7146390 8afbf0d8
......@@ -19,8 +19,6 @@ along with simcaq-node. If not, see <https://www.gnu.org/licenses/>.
*/
module.exports = function cineDetailed(id) {
switch (id) {
case 11:
return 'Programas básicos';
case 111:
return 'Ciência da educação';
case 112:
......
......@@ -20,8 +20,6 @@ along with simcaq-node. If not, see <https://www.gnu.org/licenses/>.
module.exports = function cineGeral(id) {
switch (id) {
case 0:
return 'Programas básicos';
case 1:
return 'Educação';
case 2:
......
......@@ -21,8 +21,6 @@ along with simcaq-node. If not, see <https://www.gnu.org/licenses/>.
module.exports = function cineSpecific(id) {
switch (id) {
case 1:
return 'Programas básicos';
case 11:
return 'Educação';
case 18:
......
......@@ -21,7 +21,7 @@ along with simcaq-node. If not, see <https://www.gnu.org/licenses/>.
module.exports = function contractType(id) {
switch (id) {
case 1:
return 'Concursado/Efetivo/Estável';
return 'Concursado/ Efetivo/ Estável';
case 2:
return 'Contrato temporário';
case 3:
......
......@@ -32,6 +32,7 @@ module.exports = function ethnicGroupIES(id) {
return 'Amarela';
case 5:
return 'Indígena';
case 9:
default:
return 'Não dispõe da informação (Não resposta)';
}
......
......@@ -32,6 +32,7 @@ module.exports = function ethnicGroupTeacherIES(id) {
return 'Amarela';
case 5:
return 'Indígena';
case 9:
default:
return 'Não dispõe da informação (Não resposta)';
}
......
......@@ -18,7 +18,7 @@ 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 govermentAgreement(id) {
module.exports = function governmentAgreement(id) {
switch (id) {
case 1:
return 'Convênio com rede Municipal';
......@@ -32,6 +32,7 @@ module.exports = function govermentAgreement(id) {
return 'Privada sem detalhamento';
case 6:
return 'Não se aplica (pública)';
case "null":
default:
return 'Não classificada';
}
......
......@@ -18,12 +18,13 @@ 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 studentDeficiency(id) {
module.exports = function schoolType(id) {
switch (id) {
case 1:
return 'Pública';
case 2:
return 'Privada';
case 9:
default:
return 'Não classificado';
}
......
......@@ -24,6 +24,7 @@ module.exports = function studentDeficiency(id) {
return 'Não';
case 1:
return 'Sim';
case 9:
default:
return 'Não declarado'
}
......
......@@ -28,7 +28,9 @@ module.exports = function upperTurn(id) {
return 'Noturno';
case 4:
return 'Integral';
default:
case 99:
return 'Não aplicavel (Ead)';
default:
return 'Não classificada';
}
};
......@@ -81,7 +81,7 @@ const teacherSchooling = require(`${libs}/convert/teacherSchooling`);
const ethnicGroupTeacherIES = require(`${libs}/convert/ethnicGroupTeacherIES`);
const genderIES = require(`${libs}/convert/genderIES`);
const deficiency = require(`${libs}/convert/studentDeficiency`);
const govermentAgreement = require(`${libs}/convert/govermentAgreement`);
const governmentAgreement = require(`${libs}/convert/governmentAgreement`);
const arrangement = require(`${libs}/convert/arrangement`);
const nightTime = require(`${libs}/convert/nightTime`);
const discipline = require(`${libs}/convert/discipline`);
......@@ -110,7 +110,7 @@ const ids = {
ethnic_group_id: ethnicGroup,
agreement_id: agreement,
integral_time_id: integralTime,
government_agreement_id: govermentAgreement,
government_agreement_id: governmentAgreement,
education_day_care_child_id: booleanVariable,
education_preschool_child_id: booleanVariable,
education_begin_elementary_school_id: booleanVariable,
......@@ -278,7 +278,7 @@ module.exports = {
genderIES,
deficiency,
transport,
govermentAgreement,
governmentAgreement,
arrangement,
nightTime,
discipline,
......
......@@ -12,6 +12,11 @@ const nullFields = [
]
function parseWhereValue(type, value, relation) {
if (value == null)
return null;
if (value.toString().toLowerCase() == "null")
return null;
if(type === 'integer') return parseInt(value, 10);
if(type === 'double') return parseFloat(value);
if(type === 'string' && relation === 'LIKE') return '%'+value+'%';
......@@ -21,12 +26,8 @@ function parseWhereValue(type, value, relation) {
return value;
}
if(typeof value === 'string') {
if(value.toLowerCase() === 'true' || value.toLowerCase() === '1') {
if(value.toLowerCase() === 'true' || value.toLowerCase() === '1')
return true;
}
if(value.toLowerCase() === 'null') {
return null;
}
}
return false;
}
......@@ -42,9 +43,13 @@ function getConvertName(whereField){ // TODO: mudar para regex
}
function isNull(curFilter, value){
// TODO: Remove this function
if (value == null)
return true;
let convertName = getConvertName(curFilter)
if (id2str[convertName] !== undefined)
if (id2str[convertName] !== undefined){
return nullFields.indexOf(id2str[convertName](value)) > -1
}
return false;
}
......@@ -328,7 +333,7 @@ class ReqQueryFields {
for(let i = 0; i < whereValue.length; ++i) {
let curRelation = value.where.relation;
let curValue = parseWhereValue(value.where.type, whereValue[i],value.where.relation)
if (isNull(k, curValue) ) {
if (isNull(k, curValue)) {
curValue = null;
curRelation = "is";
}
......
......@@ -80,7 +80,7 @@ auxiliarApp.get('/education_type', (req, res, next) => {
auxiliarApp.get('/adm_dependency_detailed', (req, res, next) => {
req.result = [];
for(let i = 1; i <= 6; ++i) {
for(let i = 1; i <= 7; ++i) {
req.result.push({
id: i,
name: id2str.admDependencyPriv(i)
......@@ -120,7 +120,7 @@ auxiliarApp.get('/diff_location', (req, res, next) => {
auxiliarApp.get('/education_level_mod', (req, res, next) => {
req.result = [];
for(let i = 1; i <= 11; ++i) {
for(let i = 1; i <= 12; ++i) {
req.result.push({
id: i,
name: id2str.educationLevelMod(i)
......
......@@ -140,7 +140,7 @@ classApp.get('/integral_time', (req, res, next) => {
// Returns all educational levels avaible
classApp.get('/education_level_mod', (req, res, next) => {
req.result = [];
for(let i = 1; i <=11; ++i) {
for(let i = 1; i <=12; ++i) {
req.result.push({
id: i,
name: id2str.educationLevelMod(i)
......
......@@ -626,10 +626,9 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
educationLevel = {
education_level_short_id: enrollmentEducationLevel.id,
education_level_short_name: enrollmentEducationLevel.name,
enrollment: {
integral_percentage: level_diagnosis,
integral_time: integral_time,
integral_percentage: req.dims.school ? level_diagnosis : Math.max(level_diagnosis, enrollmentEducationLevel.integralTimeOfferGoal),
integral_time: req.dims.school ? integral_time : Math.round(integral_time_total * Math.max(level_diagnosis, enrollmentEducationLevel.integralTimeOfferGoal)/100),
integral_time_total: integral_time_total,
total_enrollment_day: 0,
total_enrollment_night: 0,
......@@ -713,7 +712,8 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
}
}
let currentIntegralOfferGoal = Math.max(enrollmentEducationLevel.integralTimeOfferGoal, educationLevel.enrollment.integral_percentage);
let currentIntegralOfferGoal = educationLevel.enrollment.integral_percentage;
let currentNumberStudentClass = (enrollment.location_id == 1) ? enrollmentEducationLevel.numberStudentClass.urban : enrollmentEducationLevel.numberStudentClass.country;
// Soma os totais de matrícula da etapa de ensino
......@@ -1233,3 +1233,4 @@ classroomCountApp.post('/', rqf.parse(), (req, res, next) => {
}, response('classroom_count'));
module.exports = classroomCountApp;
......@@ -132,7 +132,7 @@ courseCountApp.get('/ocde_detailed', (req, res, next) => {
courseCountApp.get('/cine_geral', (req, res, next) => {
req.result = [];
for(let i = 0; i <= 10; ++i) {
for(let i = 1; i <= 10; ++i) {
req.result.push({
id: i,
name: id2str.cineGeral(i)
......
......@@ -644,9 +644,9 @@ disciplinesApp.get('/', rqf.parse(), (req, res, next) => {
if (req.tmp_discipline){
Object.keys(r).forEach(k => {
if (/^total_suitable/.test(k)) // if k starts with total_suitable
if (/^total_suitable_/.test(k)) // if k starts with total_suitable
obj.sum_suitable += parseInt(r[k]);
else if (/^total_/.test(k))
else if (/^total_(?!suitable)/.test(k))
obj.sum_total += parseInt(r[k]);
})
} else {
......
......@@ -194,7 +194,7 @@ enrollmentApp.get('/gender', (req, res, next) => {
// Return ethnic group
enrollmentApp.get('/ethnic_group', (req, res, next) => {
req.result = [];
for(let i = 1; i <=5; ++i) {
for(let i = 0; i <=5; ++i) {
req.result.push({
id: i,
name: id2str.ethnicGroup(i)
......@@ -621,7 +621,138 @@ rqf.addField({
type: 'integer',
field: 'turma_turno_id'
}
}, 'filter');
}, 'filter')
.addValue({
name: 'low_vision',
table: 'matricula',
tableField: 'baixa_visao',
resultField: 'low_vision',
where: {
relation: '=',
type: 'boolean',
field: 'baixa_visao'
}
}).addValue({
name: 'blindness',
table: 'matricula',
tableField: 'cegueira',
resultField: 'blindness',
where: {
relation: '=',
type: 'boolean',
field: 'cegueira'
}
}).addValue({
name: 'deafness',
table: 'matricula',
tableField: 'surdez',
resultField: 'deafness',
where: {
relation: '=',
type: 'boolean',
field: 'surdez'
}
}).addValue({
name: 'hearing_deficiency',
table: 'matricula',
tableField: 'deficiencia_auditiva',
resultField: 'hearing_deficiency',
where: {
relation: '=',
type: 'boolean',
field: 'deficiencia_auditiva'
}
}).addValue({
name: 'deafblindness',
table: 'matricula',
tableField: 'surdo_cegueira',
resultField: 'deafblindness',
where: {
relation: '=',
type: 'boolean',
field: 'surdo_cegueira'
}
}).addValue({
name: 'physical_disability',
table: 'matricula',
tableField: 'deficiencia_fisica',
resultField: 'physical_disability',
where: {
relation: '=',
type: 'boolean',
field: 'deficiencia_fisica'
}
}).addValue({
name: 'intellectual_disability',
table: 'matricula',
tableField: 'deficiencia_intelectual',
resultField: 'intellectual_disability',
where: {
relation: '=',
type: 'boolean',
field: 'deficiencia_intelectual'
}
}).addValue({
name: 'multiple_disabilities',
table: 'matricula',
tableField: 'deficiencia_multiplas',
resultField: 'multiple_disabilities',
where: {
relation: '=',
type: 'boolean',
field: 'deficiencia_multiplas'
}
}).addValue({
name: 'autism',
table: 'matricula',
tableField: 'autismo',
resultField: 'autism',
where: {
relation: '=',
type: 'boolean',
field: 'autismo'
}
}).addValue({
name: 'asperger_syndrom',
table: 'matricula',
tableField: 'sindrome_asperger',
resultField: 'asperger_syndrom',
where: {
relation: '=',
type: 'boolean',
field: 'sindrome_asperger'
}
}).addValue({
name: 'rett_syndrom',
table: 'matricula',
tableField: 'sindrome_rett',
resultField: 'rett_syndrom',
where: {
relation: '=',
type: 'boolean',
field: 'sindrome_rett'
}
}).addValue({
name: 'childhood_desintegrative_disorder',
table: 'matricula',
tableField: 'transtorno_desintegrativo_da_infancia',
resultField: 'childhood_desintegrative_disorder',
where: {
relation: '=',
type: 'boolean',
field: 'transtorno_desintegrativo_da_infancia'
}
}).addValue({
name: 'supergifted',
table: 'matricula',
tableField: 'superdotado',
resultField: 'supergifted',
where: {
relation: '=',
type: 'boolean',
field: 'superdotado'
}
});
enrollmentApp.get('/', rqf.parse(), (req, res, next) => {
req.sql.field('COUNT(*)', 'total')
......
......@@ -92,11 +92,14 @@ schoolApp.get('/adm_dependency_detailed', cache('15 day'), (req, res, next) => {
}, response('adm_dependency_detailed'));
schoolApp.get('/government_agreement', cache('15 day'), (req, res, next) => {
req.result = [];
for(let i = 1; i <= 7; ++i) {
req.result = [{
id: "null",
name: id2str.governmentAgreement("null")
}];
for(let i = 1; i <= 6; ++i) {
req.result.push({
id: i,
name: id2str.govermentAgreement(i)
name: id2str.governmentAgreement(i)
});
};
next();
......@@ -497,8 +500,8 @@ rqfCount.addField({
resultField: 'government_agreement_id',
where: {
relation: '=',
type: 'boolean',
field: 'conveniada_pp'
type: 'integer',
field: 'dependencia_convenio_publico'
}
}).addValue({
name: 'integral_time',
......
......@@ -199,11 +199,18 @@ universityEnrollmentApp.get('/upper_turn', (req, res, next) => {
name: id2str.upperTurn(i)
});
};
req.result.push({
id: 99,
name: id2str.upperTurn(99)
});
next();
}, response('upper_turn'));
universityEnrollmentApp.get('/student_deficiency', (req, res, next) => {
req.result = [];
req.result = [{
id: 9,
name: id2str.studentDeficiency(9)
}];
for(let i = 0; i <= 1; ++i) {
req.result.push({
id: i,
......@@ -214,8 +221,11 @@ universityEnrollmentApp.get('/student_deficiency', (req, res, next) => {
}, response('student_deficiency'));
universityEnrollmentApp.get('/ethnic_group_ies', (req, res, next) => {
req.result = [];
for(let i = 1; i <=5; ++i) {
req.result = [{
id: 9,
name: id2str.ethnicGroupIES(9)
}];
for(let i = 0; i <=5; ++i) {
req.result.push({
id: i,
name: id2str.ethnicGroupIES(i)
......@@ -225,7 +235,10 @@ universityEnrollmentApp.get('/ethnic_group_ies', (req, res, next) => {
}, response('ethnic_group_ies'));
universityEnrollmentApp.get('/school_type', (req, res, next) => {
req.result = [];
req.result = [{
id: 9,
name: id2str.schoolType(9)
}];
for(let i = 1; i <= 2; ++i) {
req.result.push({
id: i,
......@@ -819,7 +832,7 @@ universityEnrollmentApp.get('/enrollment_situation', rqf.parse(), (req, res, nex
.group('localoferta_ens_superior_matricula.ano_censo')
.order('localoferta_ens_superior_matricula.ano_censo')
next()
}, rqf.build(), query, (req, res, next) => {
}, rqf.build(),query, (req, res, next) => {
for (var res of req.result){
res.cursando = Number(res.cursando);
res.concluinte = Number(res.concluinte);
......@@ -827,8 +840,10 @@ universityEnrollmentApp.get('/enrollment_situation', rqf.parse(), (req, res, nex
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
module.exports = universityEnrollmentApp;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment