fix: show only vegan food in vegan food dropdown
This commit is contained in:
parent
944ddbff60
commit
07050a5809
@ -31,20 +31,28 @@ public class CreateFoodplanController {
|
||||
ChoiceBox secondDessert;
|
||||
|
||||
private List<Food> foods;
|
||||
private List<Food> veganFoods;
|
||||
private List<Food> desserts;
|
||||
private List<Food> veganDesserts;
|
||||
private FoodPlan currentPlan;
|
||||
|
||||
|
||||
@FXML
|
||||
public void initialize() {
|
||||
veganFoods = FoodMgr.getVeganFood(false);
|
||||
foods = FoodMgr.getFood(false);
|
||||
veganDesserts = FoodMgr.getVeganFood(true);
|
||||
desserts = FoodMgr.getFood(true);
|
||||
|
||||
ObservableList<Object> foodOptions = FXCollections.observableArrayList(foods.stream().map(food -> food.getId() + ": " + food.getName()).toList().toArray(new String[0]));
|
||||
firstMeal.setItems(foodOptions);
|
||||
ObservableList<Object> veganFoodOptions = FXCollections.observableArrayList(veganFoods.stream().map(food -> food.getId() + ": " + food.getName()).toList().toArray(new String[0]));
|
||||
ObservableList<Object> veganDessertOptions = FXCollections.observableArrayList(veganDesserts.stream().map(dessert -> dessert.getId() + ": " + dessert.getName()).toList().toArray(new String[0]));
|
||||
ObservableList<Object> dessertOptions = FXCollections.observableArrayList(desserts.stream().map(dessert -> dessert.getId() + ": " + dessert.getName()).toList().toArray(new String[0]));
|
||||
firstMeal.setItems(veganFoodOptions);
|
||||
secondMeal.setItems(foodOptions);
|
||||
|
||||
ObservableList<Object> dessertOptions = FXCollections.observableArrayList(desserts.stream().map(dessert -> dessert.getId() + ": " + dessert.getName()).toList().toArray(new String[0]));
|
||||
firstDessert.setItems(dessertOptions);
|
||||
|
||||
firstDessert.setItems(veganDessertOptions);
|
||||
secondDessert.setItems(dessertOptions);
|
||||
|
||||
date.setValue(LocalDate.now());
|
||||
|
Loading…
Reference in New Issue
Block a user