diff --git a/CHANGELOG.md b/CHANGELOG.md index dd7925476dc3f76693ae4014bc53fdae5e3c2bcd..d05f79f1877a8548c4dbce9e80162b6c07b97fec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,9 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## 1.11.4 - 2019-06-17 ## Changed -- Changed enrollment varaible +- Changed enrollment variable - Added location and latitude to state and city - Changed courseCount variables +- Removed 'Not classified' from teacher ## 1.11.3 - 2019-06-17 ## Changed diff --git a/src/libs/routes/teacher.js b/src/libs/routes/teacher.js index 128b5e4f1868b5e13f5dec2916a8237b79d51267..ff712b525f6e3bf066404167ee938fa1310f5998 100644 --- a/src/libs/routes/teacher.js +++ b/src/libs/routes/teacher.js @@ -1,3 +1,23 @@ +/* +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/>. +*/ + const express = require('express'); const teacherApp = express.Router(); @@ -18,10 +38,6 @@ const id2str = require(`${libs}/middlewares/id2str`); const config = require(`${libs}/config`); -const passport = require('passport'); - -const download = require(`${libs}/middlewares/downloadDatabase`); - const addMissing = require(`${libs}/middlewares/addMissing`); const cache = require('apicache').options({ debug: config.debug, statusCodes: {include: [200]} }).middleware; @@ -81,11 +97,6 @@ teacherApp.get('/education_level_mod', (req, res, next) => { name: id2str.educationLevelMod(i) }); } - - req.result.push({ - id: 99, - name: id2str.educationLevelMod(99) - }); next(); }, response('education_level_mod')); @@ -408,37 +419,6 @@ teacherApp.get('/', rqf.parse(), (req, res, next) => { } next(); -}, rqf.build(), query, addMissing(rqf), (req, res, next) => { - req.oldResult = req.result; - if(req.hadEducationLevelMod) { - - req.sql = squel.select() - .field('COUNT(DISTINCT docente.id_docente)', 'total') - .field("'Brasil'", 'name') - .field('docente.ano_censo', 'year') - .from('docente') - .join('turma', null, 'docente.turma_id=turma.id AND docente.ano_censo=turma.ano_censo') - .group('docente.ano_censo') - .order('docente.ano_censo') - .where('(docente.tipo_docente = 1 OR docente.tipo_docente = 5) AND (turma.tipo_turma_id <= 3)') - .where('docente.profissionalizante = 1'); - - rqf.build()(req, res, () => {}); - query(req, res, next); - } else { - next(); - } -}, (req, res, next) => { - if(req.hadEducationLevelMod) { - req.result.forEach((result) => { - result.education_level_mod_id = 11; - req.oldResult.push(result); - }); - } - req.result = req.oldResult; - next(); -}, id2str.transform(), response('teacher')); - -teacherApp.get('/download', passport.authenticate('bearer', { session: false }), rqf.parse(), rqf.build(), download('docente', 'mapping_docente')); +}, rqf.build(), query, addMissing(rqf), id2str.transform(), response('teacher')); module.exports = teacherApp;