Speisekammer — Wartezeit von 2 Tagen, bevor abgehakte Soll-Menge-Artikel erneut auf die Einkaufsliste kommen #193
Labels
No labels
priority/could
priority/must
priority/should
priority/wont
status/blocked
status/claimed
status/done-migrated
type/bug
type/feature
type/infra
type/tech-debt
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
robert/todo#193
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Story: Wartezeit vor erneutem Nachbestellen unterhalb der Soll-Menge
As a Speisekammer-Nutzer,
I want to dass ein Produkt, das wegen Unterschreitens seiner Soll-Menge automatisch auf die Einkaufsliste gesetzt und dort abgehakt wurde (z. B. im Supermarkt eingekauft, aber noch nicht in die Speisekammer eingebucht), nicht sofort wieder auf die Einkaufsliste zurückgeschrieben wird,
so that ich nicht jeden Tag denselben bereits gekauften Artikel erneut auf der Liste sehe, nur weil ich das Einbuchen in die Speisekammer noch nicht nachgeholt habe.
Hintergrund: Bereits heute gilt (#94 /
PantryLowStockShoppingWriter): Ist die Soll-Menge höher als der aktuelle Bestand, wird die fehlende Menge automatisch auf die verknüpfte Einkaufsliste geschrieben. Das soll erhalten bleiben. Neu ist die Wartezeit nach dem Abhaken.Acceptance criteria:
ShoppingProductInCartSource.PantryAuto) abgehakt (in den Warenkorb gelegt), wird für das zugehörige Speisekammer-Produkt eine Sperrfrist von 2 Tagen ab dem Abhak-Zeitpunkt gesetzt.Out of scope for this story:
Open questions: (escalate to human if unanswered)
Als Backlog-Item vom Nutzer eingereicht (per Chat, nicht im laufenden Loop-Zyklus geclaimt).
Abhängigkeit: setzt voraus, dass #195 (Bugfix: Soll-Menge-Unterschreitung wird bei jeder relevanten Änderung geprüft, nicht nur beim Check-Out) zuerst oder zusammen mit dieser Story umgesetzt wird — sonst greift die hier beschriebene Sperrfrist nur für den Teil der Fälle, die heute schon einen automatischen Einkaufslisten-Eintrag auslösen.
Claiming this. Plan: add a ReorderCooldownUntil timestamp on PantryProductEntity, set it (now + 2 days) from SetShoppingProductInCartCommandHandler when InCart is set to true on a product whose ActivatedVia is PantryAuto, and have PantryLowStockShoppingWriter skip the automatic write while the cooldown is still active. Dependency on
#195is already merged on master, so both cases (check-out and target/quantity edits) will be covered. Manual add stays unaffected since it never goes through the writer. Backend-only change, no UI needed per the AC.Done. Summary:
Scope: Added a 2-day cooldown so a pantry product that was auto-written onto the shopping list (because stock fell below its Soll-Menge) does not immediately reappear once its shopping entry is checked off, even while stock is still below target.
Implementation:
PantryProductEntity.ReorderCooldownUntil(nullable timestamp) - new column via migrationAddPantryProductReorderCooldown.SetShoppingProductInCartCommandHandler: whenInCartis set true on an entry whoseActivatedVia == PantryAuto, the newPantryAutoReorderCooldownWriterfinds the linked pantry product(s) (matched via the pantry whoseTargetShoppingListIdis this list, by case-insensitive name) and sets the cooldown to now + 2 days.PantryLowStockShoppingWriter(the shared writer used by check-out, and by target/quantity edits per#195) now skips its automatic write while the cooldown is still active, even if stock remains below target.Tests: New handler tests for both sides (cooldown blocks the write while active / write resumes once expired / cooldown is set only for
PantryAuto+InCart=true, not for manual entries or for checking back off). Full local suite green (978 Checkly.Tests + 52 WebApi.Tests + 119 Common.Tests).Note: implementation coincided with
#192(concurrent session, same directory) renaming the shared writer (WriteMissingAmountIfBelowTarget->WriteRestockAmountIfBelowTargetwith a newrestockQuantityparam) - reconciled via stash/pull/pop rather than racing the push; both features' call-site changes now coexist cleanly.Backend-only, no UI change (not requested by the AC).
Commits:
91c27061(implementation),0b70b841(team-memory notes).