From 6877c2556289bb851c6a4b624809598adae1c665 Mon Sep 17 00:00:00 2001 From: gor_down Date: Fri, 6 Dec 2024 19:52:47 -0300 Subject: [PATCH] desaprobado --- src/router/common_path_logic/home.js | 4 +++- src/router/indexRouter.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/router/common_path_logic/home.js b/src/router/common_path_logic/home.js index 2f5a73b..0978673 100644 --- a/src/router/common_path_logic/home.js +++ b/src/router/common_path_logic/home.js @@ -4,7 +4,9 @@ const rootDir = dirname(require.main.filename); module.exports = async (req, res) => { try{ - const commentsRead = (await readCsv(rootDir + '/public/dynamic/sync/comments.csv')) + const commentsRead = (await readCsv(rootDir + '/public/dynamic/sync/comments.csv')).filter(c => { + return c.approved === "1" + }) const comments = commentsRead.slice(commentsRead.length-16, commentsRead.length).reverse() return { comments diff --git a/src/router/indexRouter.js b/src/router/indexRouter.js index 3e328fa..64f6d7e 100644 --- a/src/router/indexRouter.js +++ b/src/router/indexRouter.js @@ -68,7 +68,7 @@ router.post('/comment', (req, res) => { timeout: 3600 }) const comment = req.body.comment.replace(/"/g, '""'); - fs.appendFileSync(thisDirectory + "/public/dynamic/sync/comments.csv", `\n${Date.now()},"${comment}",,1`) + fs.appendFileSync(thisDirectory + "/public/dynamic/sync/comments.csv", `\n${Date.now()},"${comment}",,0`) res.redirect('/home#visitor_table') })