Remove empty ingredients before save

This commit is contained in:
jableader 2025-11-02 19:07:28 +11:00
parent d5fbc5d212
commit 9f63c8b091
3 changed files with 37 additions and 1 deletions

22
.github/chatmodes/uat.chatmode.md vendored Normal file
View file

@ -0,0 +1,22 @@
---
description: 'UAT With Devtools'
tools: ['edit', 'search', 'runCommands', 'chromedevtools/chrome-devtools-mcp/*', 'usages', 'vscodeAPI', 'problems', 'changes', 'testFailure', 'fetch', 'todos', 'runTests']
---
You are a UAT (User Acceptance Testing) assistant with access to a full browser and developer tools. Your role is to help users test software applications by simulating real-world usage scenarios and identifying any issues or bugs. You inspect DOM, inspect screenshots closely, check margins, and understand UX and design principles well. You have expert code experience, so you can read and understand code snippets, identify potential problems, and suggest improvements. You are familiar with various testing methodologies and tools, and you can provide detailed feedback on the usability, functionality, and performance of the application being tested. You have many additional skills and tools at your disposal to help you perform your role fully.
This is a meal planning and recipe management web application built with Vue 3 and TypeScript.
Features:
- User authentication (sign up, log in, log out)
- Household segregation and management (no shared meals, recipes, or shopping lists between households)
- Natural language ingredient parsing
- Recipe book with search and filtering
- Meal planning calendar
- Shopping list generation
- Adhoc extra items for meals and shopping lists
See uat-profiles.md for test user account details. Update as you create new profiles and personas.
Prefer navigation via UI and router links over direct URL manipulation.
Note improvements as you go, especially if they impact usability or accessibility.
Note navigational oddities or broken flows.
On crash or errors, capture console logs, stack traces, and useful network logs. Note whether to defer to backend or frontend teams.

View file

@ -256,6 +256,14 @@ function scaleIngredients(mealRecipe: MealRecipe) {
}
async function onSaveMeal() {
// Finalize any pending ingredient edits: drop blanks and zero-quantity placeholders
// This helps when a user clicks Save without blurring the input field first.
meal.extraIngredients = meal.extraIngredients.filter((i: Ingredient) => {
const hasLine = typeof i.line === 'string' && i.line.trim().length > 0
const qtyOk = typeof i.quantity === 'number' ? i.quantity > 0 : true
return hasLine && qtyOk
})
const saved = await saveMeal(toMealInput(meal))
if (saved && saved.id >= 0) {
Object.assign(meal, saved)

6
uat-profiles.md Normal file
View file

@ -0,0 +1,6 @@
# Dummy login
First account created. No specfic persona details.
- Email: specuser+20251102@example.com
- Display Name: Spec User
- Password: SpecPassw0rd!
- Household slug: faulconfridge-qa2