mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-11-08 04:56:32 -05:00
Fix infinite loop in meal planner randomizer (#346)
Infinite loop would happen if there were more days than recipes
This commit is contained in:
@@ -167,11 +167,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
getRandom(list) {
|
getRandom(list) {
|
||||||
let recipe = 1;
|
return list[Math.floor(Math.random() * list.length)];
|
||||||
while (this.usedRecipes.includes(recipe)) {
|
|
||||||
recipe = list[Math.floor(Math.random() * list.length)];
|
|
||||||
}
|
|
||||||
return recipe;
|
|
||||||
},
|
},
|
||||||
random() {
|
random() {
|
||||||
this.usedRecipes = [1];
|
this.usedRecipes = [1];
|
||||||
|
|||||||
Reference in New Issue
Block a user