Skip to content

1.7.0

βš™οΈ Patch 1.7.0 β€” Penner Management, dark mode, and local data sync

πŸš€ Summary

  • New Penner Management page (/penner-management) with sales analytics, article KPIs, per-article price/sales insights, and a dedicated Omni API in service_omni.
  • Price-wave reconstruction fixed: adaptation dates are sorted chronologically and each wave applies a consistent 2% step from the reconstructed original price.
  • Prod β†’ local DB sync scripts for selected tables (repricer, orders, shopping list) via SSH.
  • Frontend caching for Penner API responses (10-minute localStorage TTL) and a global dark mode with per-user preference persistence.

✨ Improvements

  • Penner Management (backend β€” service_omni):
  • GET /penner/sales?period=… β€” attributed Amazon/Plenty order lines after the first price reduction; periods: yesterday, 7d, 30d, Q1–Q4.
  • GET /penner/articles β€” penner articles with stock, 30d sales, capital bound, channel prices (original vs current), reduction waves, and sortable columns.
  • GET /penner/articles/{sku}/insights β€” price timeline per wave/channel and sales segmented before/after each adaptation (365-day window).
  • Joins repricer_articles (+ channel detail tables) with amazon_orders, plenty_orders, and shopping_table.
  • Penner Management (frontend):
  • Sales tab: period chips, gross-revenue summary, order-line table, and an info alert explaining attribution rules.
  • Articles tab: expandable channel prices, Bestandsanalyse (days since last sale with colour buckets), sort chips, and chart icon for per-article insights.
  • Article insights dialog: stacked bar chart of sales quantity (Stk.) by phase (before/after each wave), price step chart, and chronological wave list.
  • Navigation entry Penner Management enabled in the dashboard sidebar.
  • Local DB sync (scripts/db-sync/):
  • sync-from-prod.ps1 / sync-from-prod.sh β€” SSH dump from prod Postgres, truncate local tables, restore; configurable via config.local.env.
  • tables.json β€” sync scope (repricer + details, amazon_orders, plenty_orders, shopping_table).
  • schema-patches.sql β€” local schema drift fixes (e.g. shopping_table.row_number).
  • Frontend performance:
  • Penner API responses cached in localStorage (10 min TTL, keyed by endpoint + params/SKU).
  • Tabs stay mounted when switching Sales ↔ Articles to avoid unnecessary reloads.
  • Dark mode:
  • Global MUI light/dark theme via AppThemeProvider.
  • Toggle in the dashboard header, Settings β†’ Appearance, and on the login page.
  • Preference stored per user (id / username / email) in localStorage (dashboard_user_prefs); restored automatically on login.

πŸ› Bug Fixes

  • Price waves: unsorted price_adaptation_dates no longer map to the wrong wave index; waves are ordered by date and prices decrease monotonically (2% per step).
  • Price ratios: fixed _remaining_wave_multiplier slice so explicit per-wave ratios (e.g. [0.98, 0.98, 0.98]) no longer swap intermediate wave prices.
  • Penner filtering: scalar or invalid price_adaptation_dates values are skipped in Python instead of causing jsonb_array_length errors.
  • Penner recalc guards: zero ratios values no longer cause division-by-zero in wave history reconstruction.
  • DB sync (PowerShell): fixed SSH remote-command invocation ($Target parameter) and Unicode dash characters that broke script parsing on Windows.

πŸ“ Files changed

  • backend/service_omni/app/services/penner_management_service.py β€” analytics, price reconstruction, sales segmentation, insights.
  • backend/service_omni/app/models/penner_management.py β€” Pydantic response models.
  • backend/service_omni/app/api/v1/endpoints/penner_management.py β€” REST routes.
  • backend/service_omni/app/api/v1/api.py β€” router registration.
  • backend/service_omni/app/tests/test_penner_management_service.py β€” unit tests (price waves, segments, parsing).
  • backend/service_omni/app/crud/ β€” extended queries for orders and shopping table.
  • frontend/src/pages/PennerManagement/ β€” page, Sales/Articles tabs, insights dialog, stock-age utils.
  • frontend/src/services/api/omni/pennermanagement.js β€” API client with cache wrapper.
  • frontend/src/services/api/omni/pennerManagementCache.js β€” TTL cache helpers.
  • frontend/src/layouts/DashboardLayout/index.jsx β€” Penner nav link; theme-aware shell; dark-mode toggle.
  • frontend/src/components/AppThemeProvider.jsx, ThemeToggle.jsx, theme/index.js, store/slices/themeSlice.js, utils/themeStorage.js β€” dark mode.
  • frontend/src/App.jsx, frontend/src/pages/Settings/index.jsx, frontend/src/pages/Auth/index.jsx β€” theme integration.
  • scripts/db-sync/sync-from-prod.ps1, sync-from-prod.sh, schema-patches.sql, config.example.env, tables.json β€” prodβ†’local sync tooling.
  • docker/postgres/updates/add_row_number_to_shopping_table.sql β€” shopping_table.row_number migration.
  • docs/docs/patchnotes/1.7/1.7.0.md β€” this patchnotes entry.