From 905635c022974f744af3ed55dac146bb63508072 Mon Sep 17 00:00:00 2001 From: "Christopher C. Wells" Date: Tue, 2 Mar 2021 20:02:20 -0800 Subject: [PATCH] Only evaluate serving name in summary when serving is used --- app/Http/Controllers/JournalEntryController.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/JournalEntryController.php b/app/Http/Controllers/JournalEntryController.php index 1f4046b..e0b34fb 100644 --- a/app/Http/Controllers/JournalEntryController.php +++ b/app/Http/Controllers/JournalEntryController.php @@ -187,11 +187,13 @@ class JournalEntryController extends Controller // Update summary $unit = $ingredient['unit']; if ($item instanceof Food) { - if (empty($item->serving_unit) && empty($item->serving_unit_name)) { - $unit = null; - } - elseif (!empty($item->serving_unit_name)) { - $unit = $item->serving_unit_formatted; + if ($unit === 'serving') { + if (empty($item->serving_unit) && empty($item->serving_unit_name)) { + $unit = null; + } + elseif (!empty($item->serving_unit_name)) { + $unit = $item->serving_unit_formatted; + } } } $entries[$entry_key]->summary .= (!empty($entries[$entry_key]->summary) ? ', ' : null);