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;