1.8.8
⚙️ Patch 1.8.8 — Otto stock/reprice activation & Discord Last EK¶
🚀 Summary¶
- Otto details — when stock goes from 0 → in stock, status is set to active and
unpause_dateis cleared (sync, monitor export, stock reconcile). - Otto recalculate — with
use_min_max_rules, articles with expected profit < €2.5 are set active andunpause_datecleared (so low-profit paused rows get repriced). - Discord targets-met webhook — embeds optional Last EK and Last EK date from
shopping_table(lookup by ASIN inasin_sku).
✨ Improvements¶
Otto — back in stock → active¶
New helper activate_detail_from_stock() in article_status.py:
status→ activeerror_message→ clearedunpause_date→ null (Otto only)
Applied on OOS → active transitions during:
reconcile_article_channel_details()(all channels; unpause only where the field exists)- Otto sync quantity refresh
- Otto price monitor successful export (non-zero quantity)
Paused items are not auto-unpaused on stock alone unless recalc rules below apply.
Otto recalculate — low-profit activation¶
When use_min_max_rules is true (or force_min_max), an article is set active and unpause_date cleared if either:
| Trigger | Meaning |
|---|---|
min_max_changed |
Recalculated min/max differs from stored values |
expected_profit < 2.5 |
Current selling price yields profit below €2.5 |
Paused articles with profit ≥ €2.5 and unchanged min/max stay paused.
Constant: LOW_PROFIT_ACTIVATE_THRESHOLD_EUR = 2.5 in article_status.py.
Discord — Last EK from shopping table¶
Watchlist target met embeds (Qogita cron) now include, when data exists:
| Field | Source |
|---|---|
| Last EK | shopping_table.preis_pro_einheit_b (latest row by datum) |
| Last EK date | shopping_table.datum (DD.MM.YYYY) |
Lookup: watchlist ASIN → shopping_table.asin_sku via get_latest_purchases_by_asin_skus() (same logic as penner articles).
shopping_table CRUD: case-insensitive asin_sku match (func.upper).
✨ Tests¶
Multi-repricer (service_multi-repricer)
cd backend/service_multi-repricer
pytest app/tests/test_article_status.py app/tests/test_recalculate_channels.py::TestOttoRecalculate -v
test_oos_to_active_clears_unpause_datetest_low_profit_activates_paused_articletest_unchanged_min_max_keeps_paused_status(profit ≥ 2.5)
📁 Files changed¶
Multi-repricer
app/services/article_status.py—activate_detail_from_stock,LOW_PROFIT_ACTIVATE_THRESHOLD_EURapp/api/v1/endpoints/otto_articles.py— stock/monitor sync + recalc activation rulesapp/tests/test_article_status.py,test_recalculate_channels.py
Omni (service_omni)
app/services/price_alerts/discord_notifications.py— Last EK embed fieldsapp/services/price_alerts/watchlist_cron.py— passdbto Discord senderapp/crud/shopping_table.py— case-insensitiveasin_skulookup
🔧 Deploy¶
Restart service-multi-repricer and service-omni. No database migration.
Verify Otto
- Set a paused Otto row with stock 0, then increase base-article stock → detail should be active,
unpause_datenull. - Run Recalculate on a paused row with profit < 2.5 → should become active.
Verify Discord
- Ensure
shopping_tablehas a row with matchingasin_skufor a watchlist ASIN. - Trigger targets-met cron (or wait for schedule) → embed shows Last EK / Last EK date when present.