feat: mark cell as failed when decrementing if value is already zero

This commit is contained in:
2026-03-02 15:26:53 -05:00
parent e9bee860d7
commit 1d67d3d60c
@@ -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;