Allow recording zero eggs collected
All checks were successful
Deploy / deploy (push) Successful in 1m37s
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:
@@ -285,15 +285,27 @@ class TestProductPayloads:
|
||||
)
|
||||
assert payload.quantity == 12
|
||||
|
||||
def test_quantity_must_be_positive(self):
|
||||
"""quantity must be >= 1."""
|
||||
def test_quantity_zero_is_valid(self):
|
||||
"""quantity=0 is valid (checked but found none)."""
|
||||
from animaltrack.events.payloads import ProductCollectedPayload
|
||||
|
||||
payload = ProductCollectedPayload(
|
||||
location_id="01ARZ3NDEKTSV4RRFFQ69G5FAV",
|
||||
product_code="egg.duck",
|
||||
quantity=0,
|
||||
resolved_ids=["01ARZ3NDEKTSV4RRFFQ69G5FAV"],
|
||||
)
|
||||
assert payload.quantity == 0
|
||||
|
||||
def test_quantity_cannot_be_negative(self):
|
||||
"""quantity must be >= 0."""
|
||||
from animaltrack.events.payloads import ProductCollectedPayload
|
||||
|
||||
with pytest.raises(ValidationError):
|
||||
ProductCollectedPayload(
|
||||
location_id="01ARZ3NDEKTSV4RRFFQ69G5FAV",
|
||||
product_code="egg.duck",
|
||||
quantity=0,
|
||||
quantity=-1,
|
||||
resolved_ids=["01ARZ3NDEKTSV4RRFFQ69G5FAV"],
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user