From 1d67d3d60cdb5cb66673f92d2c53e72b05610ab5 Mon Sep 17 00:00:00 2001 From: patrick Date: Mon, 2 Mar 2026 15:26:53 -0500 Subject: [PATCH] feat: mark cell as failed when decrementing if value is already zero --- src/routes/(app)/habits/CounterHabitButton.svelte | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/routes/(app)/habits/CounterHabitButton.svelte b/src/routes/(app)/habits/CounterHabitButton.svelte index ded4759..a573b29 100644 --- a/src/routes/(app)/habits/CounterHabitButton.svelte +++ b/src/routes/(app)/habits/CounterHabitButton.svelte @@ -114,6 +114,17 @@ } else { const oldCount = count; if (e.shiftKey) { + // If already at zero, mark as failed + if (count === 0) { + const dateObj = new Date(date + 'T00:00:00.000Z'); + try { + await habitService.upsertCompletion(habitId, dateObj, 0, true); + return; + } catch (error) { + console.error('Failed to mark habit as failed:', error); + return; + } + } // Decrement but don't go below 0 - animate to 0 if needed const newCount = count - increment; count = newCount < 0 ? 0 : newCount;