From e1b05987b710179c8465320930d38ce0e700568c Mon Sep 17 00:00:00 2001
From: Rafael S Castliho <rscastilho@inf.ufpr.br>
Date: Mon, 14 Sep 2020 11:56:14 -0300
Subject: [PATCH 1/2] test_1

---
 src/libs/routes/SMPPIR/eixo_3.js | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/libs/routes/SMPPIR/eixo_3.js b/src/libs/routes/SMPPIR/eixo_3.js
index 626290ed..312e5cc7 100644
--- a/src/libs/routes/SMPPIR/eixo_3.js
+++ b/src/libs/routes/SMPPIR/eixo_3.js
@@ -131,6 +131,18 @@ rqf.addField({
     },
 })
 
+.addValue({
+    name:'cod_local_home',
+    table:'quilombola_eixo_2_ag',
+    tableField:'cod_local_domicilio',
+    resultField:'cod_local_domic_fam',
+    where: {
+        relation:'=',
+        type:'string',
+        field:'cod_local_domicilio',
+    },
+})
+
 .addValue({
     name: 'uf',
     table: 'quilombola_eixo_3_ag',
@@ -159,7 +171,7 @@ rqf.addField({
 
 cad_unico_count.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
     console.log(req.sql.toString());
-    req.sql.field('SUM(total) AS Total')
+    req.sql.field('COUNT(distinct id_familia) AS Total')
         .from('quilombola_eixo_3_ag');
     next();
 }, query, response('cad_unico'));
-- 
GitLab


From 02f59e6b13dea91f204534a8a640ad216703c70d Mon Sep 17 00:00:00 2001
From: Rafael S Castliho <rscastilho@inf.ufpr.br>
Date: Thu, 17 Sep 2020 11:47:03 -0300
Subject: [PATCH 2/2] add information to eixo

---
 src/libs/routes/SMPPIR/eixo_3.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libs/routes/SMPPIR/eixo_3.js b/src/libs/routes/SMPPIR/eixo_3.js
index 312e5cc7..7a3472d2 100644
--- a/src/libs/routes/SMPPIR/eixo_3.js
+++ b/src/libs/routes/SMPPIR/eixo_3.js
@@ -133,7 +133,7 @@ rqf.addField({
 
 .addValue({
     name:'cod_local_home',
-    table:'quilombola_eixo_2_ag',
+    table:'quilombola_eixo_3_ag',
     tableField:'cod_local_domicilio',
     resultField:'cod_local_domic_fam',
     where: {
-- 
GitLab