add artificial key for shopping_event_groceries

This commit is contained in:
2025-05-25 22:54:08 +02:00
parent b81379432b
commit 8b2e4408fc
2 changed files with 8 additions and 4 deletions

View File

@@ -158,7 +158,10 @@ const ShoppingEventForm: React.FC = () => {
const getGroceryName = (id: number) => {
const grocery = groceries.find(g => g.id === id);
return grocery ? grocery.name : 'Unknown';
if (!grocery) return 'Unknown';
const weightInfo = grocery.weight ? `${grocery.weight}${grocery.weight_unit}` : grocery.weight_unit;
return `${grocery.name} ${weightInfo}`;
};
if (loadingEvent) {
@@ -250,7 +253,7 @@ const ShoppingEventForm: React.FC = () => {
<option value={0}>Select a grocery</option>
{groceries.map(grocery => (
<option key={grocery.id} value={grocery.id}>
{grocery.name} ({grocery.category})
{grocery.name} ({grocery.category}) {grocery.weight ? `${grocery.weight}${grocery.weight_unit}` : grocery.weight_unit}
</option>
))}
</select>