diff --git a/src/main/java/ntnu/idatt2016/v233/SmartMat/service/RecipeService.java b/src/main/java/ntnu/idatt2016/v233/SmartMat/service/RecipeService.java index d99ca41f5b0a5a98c9278f0ae63c92fb916295c7..0afaa63501490a87ede9bf0d36cf9d0217096798 100644 --- a/src/main/java/ntnu/idatt2016/v233/SmartMat/service/RecipeService.java +++ b/src/main/java/ntnu/idatt2016/v233/SmartMat/service/RecipeService.java @@ -229,7 +229,13 @@ public class RecipeService { Collections.shuffle(zeroMatchRecipes); // Combine the commonRecipes and zeroMatchRecipes lists - commonRecipes.addAll(zeroMatchRecipes); + for (RecipeWithMatchCount zeroMatchRecipe : zeroMatchRecipes) { + if (commonRecipes.size() < 5) { + commonRecipes.add(zeroMatchRecipe); + } else { + break; + } + } return commonRecipes; } } \ No newline at end of file