mirror of
https://github.com/Matewoo/tablet-web-survey.git
synced 2026-11-18 13:52:47 +01:00
ignore empty results
Pressing submit without selection now ignores this result.
This commit is contained in:
@@ -44,6 +44,7 @@ app.post('/submit', (req, res) => {
|
||||
rating: results[category]
|
||||
}));
|
||||
|
||||
if (records.length > 0) {
|
||||
csvWriter.writeRecords(records)
|
||||
.then(() => {
|
||||
console.log('Received feedback:', results);
|
||||
@@ -53,8 +54,10 @@ app.post('/submit', (req, res) => {
|
||||
console.error('Error writing to CSV:', error);
|
||||
res.status(500).json({ status: 'error', message: 'Error writing to CSV' });
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Serve the survey results page
|
||||
app.get('/survey', (req, res) => {
|
||||
res.send(`
|
||||
|
||||
Reference in New Issue
Block a user