diff options
author | Marvin Borner | 2021-01-21 19:53:37 +0100 |
---|---|---|
committer | Marvin Borner | 2021-01-21 19:53:37 +0100 |
commit | a3b74559f850572e7053a32cdcbca8980088f14d (patch) | |
tree | 3736bc030098075875d33cf3d8e6fb208e2a95e1 | |
parent | ce718b9a297665c038eead55a2150b6dea4ab148 (diff) |
Whooops
-rw-r--r-- | admin/index.js | 1 | ||||
-rw-r--r-- | admin/public/ranking.js | 4 |
2 files changed, 3 insertions, 2 deletions
diff --git a/admin/index.js b/admin/index.js index f7b7c7b..a67b9f3 100644 --- a/admin/index.js +++ b/admin/index.js @@ -7,7 +7,6 @@ const { checkUser, checkAdmin } = require("../auth"); app.use( "/", (req, res, next) => { - console.log(req.path); if ((req.session.loggedIn && req.session.isAdmin) || req.path.startsWith("/api/votes")) next(); else res.redirect("/"); }, diff --git a/admin/public/ranking.js b/admin/public/ranking.js index ba44db6..e836d8b 100644 --- a/admin/public/ranking.js +++ b/admin/public/ranking.js @@ -7,7 +7,9 @@ fetch("api/questions") .then((answers) => answers.json()) .then((answers) => { questions.forEach((question) => (question.answers = [])); - answers.forEach((answer) => questions[answer.question_id - 1].answers.push(answer)); + answers.forEach((answer) => + questions.filter((q) => q.id === answer.question_id)[0].answers.push(answer), + ); render(questions); }); }); |