Fix infinite loop in meal planner randomizer

Infinite loop would happen if there were more days than recipes
This commit is contained in:
Florian Dupret 2021-04-23 15:41:29 +02:00
commit 2b3efed401

View file

@ -167,11 +167,7 @@ export default {
}
},
getRandom(list) {
let recipe = 1;
while (this.usedRecipes.includes(recipe)) {
recipe = list[Math.floor(Math.random() * list.length)];
}
return recipe;
return list[Math.floor(Math.random() * list.length)];
},
random() {
this.usedRecipes = [1];