From dcdf16631baa3b6dd7579f893bd5222160c3a88b Mon Sep 17 00:00:00 2001
From: Fernando Erd <fce15@inf.ufpr.br>
Date: Thu, 20 Sep 2018 10:33:43 -0300
Subject: [PATCH] Change population filter name

---
 src/libs/convert/citySize.js      |  2 +-
 src/libs/routes/infrastructure.js | 25 ++++++++++++++++---------
 src/libs/routes/population.js     |  2 +-
 3 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/src/libs/convert/citySize.js b/src/libs/convert/citySize.js
index 819eb150..3f50462b 100644
--- a/src/libs/convert/citySize.js
+++ b/src/libs/convert/citySize.js
@@ -1,7 +1,7 @@
 module.exports = function citySize(id) {
     switch (id) {
         case 1:
-        return 'até 5000';
+        return '0 - 5000';
         case 2:
         return '5001 - 10000';
         case 3:
diff --git a/src/libs/routes/infrastructure.js b/src/libs/routes/infrastructure.js
index 290bf1a0..8b01e338 100644
--- a/src/libs/routes/infrastructure.js
+++ b/src/libs/routes/infrastructure.js
@@ -67,19 +67,26 @@ infrastructureApp.get('/rural_location', (req, res, next) => {
 }, response('rural_location'));
 
 infrastructureApp.get('/adm_dependency', (req, res, next) => {
-    req.sql.from('dependencia_adm')
-    .field('id')
-    .field('nome', 'name')
-    .where('id <= 4');
+    req.result = [];
+    for(let i = 1; i <= 4; ++i) {
+        req.result.push({
+            id: i,
+            name: id2str.admDependency(i)
+        });
+    };
     next();
-}, query, response('adm_dependency'));
+}, response('adm_dependency'));
 
 infrastructureApp.get('/adm_dependency_detailed', (req, res, next) => {
-    req.sql.from('dependencia_adm_priv')
-    .field('id', 'id')
-    .field('nome', 'name');
+    req.result = [];
+    for(let i = 1; i <= 6; ++i) {
+        req.result.push({
+            id: i,
+            name: id2str.admDependencyPriv(i)
+        });
+    };
     next();
-}, query, response('adm_dependency_detailed'));
+}, response('adm_dependency_detailed'));
 
 rqf.addField({
     name: 'filter',
diff --git a/src/libs/routes/population.js b/src/libs/routes/population.js
index cd307cdb..f0402daa 100644
--- a/src/libs/routes/population.js
+++ b/src/libs/routes/population.js
@@ -41,7 +41,7 @@ populationApp.get('/years', (req, res, next) => {
 
 populationApp.get('/city_size', (req, res, next) => {
     req.result = [
-        {id: 1, name: "até 5000"},
+        {id: 1, name: "0 - 5000"},
         {id: 2, name: "5001 - 10000"},
         {id: 3, name: "10001 - 20000"},
         {id: 4, name: "20001 - 50000"},
-- 
GitLab