trivia: maybe true and false wont act up now? idk im dumb somtimes

This commit is contained in:
Ayden Jahola 2024-09-06 00:18:16 +01:00
джерело 06934db8b9
коміт 4572fb18ed
Не вдалося знайти GPG ключ що відповідає даному підпису
Ідентифікатор GPG ключа: 71DD90AE4AE92742

@ -96,7 +96,17 @@ module.exports = {
// Handle True/False questions specifically
if (triviaQuestion.type === "boolean") {
allAnswers = ["True", "False"];
// Always keep "True" as option 1 and "False" as option 2
answerMap = { 1: "True", 2: "False" };
} else {
// Shuffle answers for other types of questions
allAnswers = allAnswers.sort(() => Math.random() - 0.5);
// Create a mapping of numbers to answers
answerMap = allAnswers.reduce((map, answer, index) => {
map[index + 1] = answer;
return map;
}, {});
}
allAnswers = allAnswers.sort(() => Math.random() - 0.5); // Shuffle answers