desaprobado
This commit is contained in:
parent
48eeae02b4
commit
6877c25562
@ -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
|
||||||
|
@ -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')
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user