From e8c7a9f9493f1c3d513b908e8b6336639ad7fbfe Mon Sep 17 00:00:00 2001 From: Miguel Salerno <mans17@inf.ufpr.br> Date: Fri, 16 Apr 2021 19:57:07 -0300 Subject: [PATCH] remove teacherAdequacy --- src/libs/convert/teacherAdequacy.js | 28 ----------- src/libs/middlewares/id2str.js | 7 +-- src/libs/routes/disciplines.js | 73 ++++++++++------------------- 3 files changed, 27 insertions(+), 81 deletions(-) delete mode 100644 src/libs/convert/teacherAdequacy.js diff --git a/src/libs/convert/teacherAdequacy.js b/src/libs/convert/teacherAdequacy.js deleted file mode 100644 index 7cd21cbb..00000000 --- a/src/libs/convert/teacherAdequacy.js +++ /dev/null @@ -1,28 +0,0 @@ -/* -Copyright (C) 2016 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 teacherAdequacy(id) { - switch (id) { - case 0: - return 'Formação não adequada'; - case 1: - return 'Formação adequada'; - } -}; diff --git a/src/libs/middlewares/id2str.js b/src/libs/middlewares/id2str.js index af4995e9..b86232ca 100644 --- a/src/libs/middlewares/id2str.js +++ b/src/libs/middlewares/id2str.js @@ -89,7 +89,6 @@ 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 teacherAdequacy = require(`${libs}/convert/teacherAdequacy`); const ids = { gender_id: gender, @@ -170,8 +169,7 @@ const ids = { finish_id: finishUniversity, initial_training_id: initialTraining, pos_training_id: posTraining, - licentiate_degree_id: licentiateDegree, - teacher_adequacy_id: teacherAdequacy + licentiate_degree_id: licentiateDegree }; function transform(removeId=false) { @@ -279,6 +277,5 @@ module.exports = { finishUniversity, initialTraining, posTraining, - licentiateDegree, - teacherAdequacy + licentiateDegree }; diff --git a/src/libs/routes/disciplines.js b/src/libs/routes/disciplines.js index 4e1eb72b..09584a42 100644 --- a/src/libs/routes/disciplines.js +++ b/src/libs/routes/disciplines.js @@ -193,17 +193,6 @@ disciplinesApp.get('/discipline', (req, res, next) => { next(); }, response('discipline')) -// disciplinesApp.get('/teacher_adequacy', (req, res, next) => { -// req.result = []; -// for (let i = 0; i <= 1; i++) { -// req.result.push({ -// id: i, -// name: id2str.teacherAdequacy(i) -// }) -// } -// next(); -// }, response('teacher_adequacy')) - rqf.addField({ name: 'filter', field: false, @@ -466,18 +455,6 @@ rqf.addField({ } }); -// .addValue({ -// name: 'teacher_adequacy', -// table: 'docente_test', -// tableField: '', -// resultField: 'teacher_adequacy_name', -// where: { -// relation: '=', -// type: 'integer', -// field: '' -// } -// }); - disciplinesApp.get('/', rqf.parse(), (req, res, next) => { if ('discipline' in req.dims) { // delete req.filter.discipline; @@ -648,31 +625,31 @@ disciplinesApp.get('/', rqf.parse(), (req, res, next) => { req.result = results; } else { */} - // let disciplinesNotSuitable = []; - // let disciplinesSuitable = []; - - // req.result.forEach((r) => { - // let objNotSuitable = { - // total: parseInt(r.total) - parseInt(r.total_suitable), - // suitable: 0 - // } - - // let objSuitable = { - // total: parseInt(r.total_suitable), - // suitable: 1 - // } - // Object.keys(r).forEach(k => { - // if (k !== 'total' && k !== 'total_suitable') { - // objNotSuitable[k] = r[k]; - // objSuitable[k] = r[k]; - // } - // }) - - // disciplinesNotSuitable.push(objNotSuitable) - // disciplinesSuitable.push(objSuitable) - // }) - - // req.result = disciplinesNotSuitable.concat(disciplinesSuitable); + let disciplinesNotSuitable = []; + let disciplinesSuitable = []; + + req.result.forEach((r) => { + let objNotSuitable = { + total: parseInt(r.total) - parseInt(r.total_suitable), + suitable: 0 + } + + let objSuitable = { + total: parseInt(r.total_suitable), + suitable: 1 + } + Object.keys(r).forEach(k => { + if (k !== 'total' && k !== 'total_suitable') { + objNotSuitable[k] = r[k]; + objSuitable[k] = r[k]; + } + }) + + disciplinesNotSuitable.push(objNotSuitable) + disciplinesSuitable.push(objSuitable) + }) + + req.result = disciplinesNotSuitable.concat(disciplinesSuitable); next(); }, response('disciplines')); -- GitLab