Allow recording zero eggs collected
All checks were successful
Deploy / deploy (push) Successful in 1m37s

Enable recording "checked coop, found 0 eggs" to distinguish from days
when the coop wasn't checked at all. Statistics remain eggs/calendar day.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-09 06:37:31 +00:00
parent d91ee362fa
commit eee8552345
5 changed files with 34 additions and 12 deletions

View File

@@ -137,10 +137,10 @@ class TestEggCollection:
assert event_row is not None
assert event_row[0] == "ProductCollected"
def test_egg_collection_validation_quantity_zero(
self, client, location_strip1_id, ducks_at_strip1
def test_egg_collection_quantity_zero_accepted(
self, client, seeded_db, location_strip1_id, ducks_at_strip1
):
"""quantity=0 returns 422."""
"""quantity=0 is accepted (checked coop, found no eggs)."""
resp = client.post(
"/actions/product-collected",
data={
@@ -150,7 +150,17 @@ class TestEggCollection:
},
)
assert resp.status_code == 422
assert resp.status_code in [200, 302, 303]
# Verify event was created with quantity=0
event_row = seeded_db.execute(
"SELECT payload FROM events WHERE type = 'ProductCollected' ORDER BY id DESC LIMIT 1"
).fetchone()
assert event_row is not None
import json
payload = json.loads(event_row[0])
assert payload["quantity"] == 0
def test_egg_collection_validation_quantity_negative(
self, client, location_strip1_id, ducks_at_strip1