From 8e64602da3cecaf18f9fd745013fa4f00a3adf49 Mon Sep 17 00:00:00 2001
From: Lewis <lgtg20@inf.ufpr.br>
Date: Thu, 14 Nov 2024 09:50:54 -0300
Subject: [PATCH] feat: faixa de renda showing right results

---
 src/libs/convert/incomeRange.js                |  2 ++
 src/libs/routes_v1/basicEducationConclusion.js | 12 +++++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/libs/convert/incomeRange.js b/src/libs/convert/incomeRange.js
index fee5189b..a38446aa 100644
--- a/src/libs/convert/incomeRange.js
+++ b/src/libs/convert/incomeRange.js
@@ -36,5 +36,7 @@ module.exports = function incomeRange(id) {
         return 'Mais de 5 salários mínimos';
         case 9: 
         return 'Não informado ou ignorado';
+        case 10:
+        return "Ignorado"
     }
 };
diff --git a/src/libs/routes_v1/basicEducationConclusion.js b/src/libs/routes_v1/basicEducationConclusion.js
index c45cb6e5..fb745299 100644
--- a/src/libs/routes_v1/basicEducationConclusion.js
+++ b/src/libs/routes_v1/basicEducationConclusion.js
@@ -159,7 +159,7 @@ basicEducationConclusion.get('/income_range', (req, res, next) => {
             id: i, name: id2str.incomeRange(i)
         });
     }
-    req.result.push({id: 9, name: id2str.incomeRange(9)});
+    req.result.push({id: 10, name: id2str.incomeRange(10)});
     next();
 }, response('income_range'));
 
@@ -426,12 +426,12 @@ rqf.addField({
 }).addValue({
     name: 'income_range',
     table: 'pnad_novo',
-    tableField: 'faixa_rendimento_aux',
+    tableField: 'faixa_rendimento_aux_tx',
     resultField: 'income_range_id',
     where: {
         relation: '=',
         type: 'integer',
-        field: 'faixa_rendimento_aux'
+        field: 'faixa_rendimento_aux_tx'
     }
 }).addValue({
     name: 'gender',
@@ -599,8 +599,14 @@ basicEducationConclusion.get('/', rqf.parse(), rqf.build(), (req, res, next) =>
         .group("ano_ref")
         .order("ano_ref");
 
+    if (req.query.dims && req.query.dims.includes("income_range")) {
+        totalPopMaior19.where("faixa_rendimento_aux_tx is not null");
+        totalPopEdBasMaior19.where("faixa_rendimento_aux_tx is not null");
+    }
+
     req.querySet.push(totalPopEdBasMaior19);
     req.querySet.push(totalPopMaior19);
+
     next();
 }, multiQuery, (req, res, next) => {
         // The multiple requests are made. Then we need to calculate the percetange. So the function
-- 
GitLab