From a3b74559f850572e7053a32cdcbca8980088f14d Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Thu, 21 Jan 2021 19:53:37 +0100 Subject: Whooops --- admin/public/ranking.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'admin/public/ranking.js') 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); }); }); -- cgit v1.2.3