Skip to content

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_date is cleared (sync, monitor export, stock reconcile).
  • Otto recalculate — with use_min_max_rules, articles with expected profit < €2.5 are set active and unpause_date cleared (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 in asin_sku).

✨ Improvements

Otto — back in stock → active

New helper activate_detail_from_stock() in article_status.py:

  • statusactive
  • error_message → cleared
  • unpause_datenull (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_date
  • test_low_profit_activates_paused_article
  • test_unchanged_min_max_keeps_paused_status (profit ≥ 2.5)

📁 Files changed

Multi-repricer

  • app/services/article_status.pyactivate_detail_from_stock, LOW_PROFIT_ACTIVATE_THRESHOLD_EUR
  • app/api/v1/endpoints/otto_articles.py — stock/monitor sync + recalc activation rules
  • app/tests/test_article_status.py, test_recalculate_channels.py

Omni (service_omni)

  • app/services/price_alerts/discord_notifications.py — Last EK embed fields
  • app/services/price_alerts/watchlist_cron.py — pass db to Discord sender
  • app/crud/shopping_table.py — case-insensitive asin_sku lookup

🔧 Deploy

Restart service-multi-repricer and service-omni. No database migration.

Verify Otto

  1. Set a paused Otto row with stock 0, then increase base-article stock → detail should be active, unpause_date null.
  2. Run Recalculate on a paused row with profit < 2.5 → should become active.

Verify Discord

  1. Ensure shopping_table has a row with matching asin_sku for a watchlist ASIN.
  2. Trigger targets-met cron (or wait for schedule) → embed shows Last EK / Last EK date when present.