desaprobado

This commit is contained in:
simio 2024-12-06 19:52:47 -03:00
parent 48eeae02b4
commit 6877c25562
2 changed files with 4 additions and 2 deletions

View File

@ -4,7 +4,9 @@ const rootDir = dirname(require.main.filename);
module.exports = async (req, res) => { module.exports = async (req, res) => {
try{ 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() const comments = commentsRead.slice(commentsRead.length-16, commentsRead.length).reverse()
return { return {
comments comments

View File

@ -68,7 +68,7 @@ router.post('/comment', (req, res) => {
timeout: 3600 timeout: 3600
}) })
const comment = req.body.comment.replace(/"/g, '""'); 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') res.redirect('/home#visitor_table')
}) })