mirror of
https://github.com/grocy/grocy.git
synced 2025-08-18 11:27:03 +00:00
Meal plan recipe and notes also fit into one table (references #477)
This commit is contained in:
@@ -132,20 +132,8 @@ class RecipesController extends BaseController
|
||||
public function MealPlan(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
|
||||
{
|
||||
$recipes = $this->Database->recipes()->where('type', RecipesService::RECIPE_TYPE_NORMAL)->fetchAll();
|
||||
|
||||
$events = array();
|
||||
|
||||
foreach($this->Database->meal_plan_notes() as $mealPlanNote)
|
||||
{
|
||||
$events[] = array(
|
||||
'id' => intval($mealPlanNote['id']) * -1,
|
||||
'title' => '',
|
||||
'start' => $mealPlanNote['day'],
|
||||
'date_format' => 'date',
|
||||
'note' => json_encode($mealPlanNote),
|
||||
'type' => 'note'
|
||||
);
|
||||
}
|
||||
|
||||
foreach($this->Database->meal_plan() as $mealPlanEntry)
|
||||
{
|
||||
$recipe = FindObjectInArrayByPropertyValue($recipes, 'id', $mealPlanEntry['recipe_id']);
|
||||
@@ -162,7 +150,7 @@ class RecipesController extends BaseController
|
||||
'date_format' => 'date',
|
||||
'recipe' => json_encode($recipe),
|
||||
'mealPlanEntry' => json_encode($mealPlanEntry),
|
||||
'type' => 'recipe'
|
||||
'type' => $mealPlanEntry['type']
|
||||
);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user