From 6556228b6bfed0316ec7ba72e21289545cba7f35 Mon Sep 17 00:00:00 2001 From: hugorochaffs <54285732+hugorochaffs@users.noreply.github.com> Date: Thu, 3 Dec 2020 21:37:37 -0300 Subject: [PATCH] Resolvidos erros pontuais --- js/db.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/js/db.js b/js/db.js index 292ee0a..71c364e 100644 --- a/js/db.js +++ b/js/db.js @@ -100,14 +100,10 @@ async function insertCaso(caso){ const conn = await connect(); var data = new Date(); var dataA = data.getFullYear()+"-"+data.getMonth()+"-"+data.getDate() - const sql = 'SELECT COUNT(*) AS countCasos FROM casos WHERE cid = "'+caso.cid+'" AND data ="'+dataA+'" AND usuario ="'+caso.usuario+'" AND ra ="'+caso.ra+'"'; - const [rows] = await conn.query(sql); - if(rows[0].countCasos<=0){ const sql = 'INSERT INTO casos(cid,data,usuario,ra,dataOcorrencia) VALUES (?,?,?,?,?);'; const values = [caso.cid,dataA,caso.usuario,caso.ra,caso.dataOcorrencia]; if(conn.query(sql, values)){return await 1;}else{return await 0;} -} -else{return await 3;} + } async function selectUser(user){