- Two numbers in one field (XXX / YYY) → take first 10 digits
- Text in field (Екатерина +7978...) → extract digits only
- 8 prefix → 7 (Russian landline style)
- 10 digits (no country code) → prepend 7
- All 4 SMS scripts patched (first, second, paid_storage)
Scenario 3 (link_ready + next_check expired) now requires EXISTS
in sms_campaign_log. Prevents groups from being moved to
manual_required before first SMS is ever sent.
Bug: sms_manual_campaign.py condition 2 caught first_sms_sent groups after 3h
WITHOUT checking if second SMS was already sent. This caused manual campaign
(5min timer) to move groups to manual_required before second campaign (10min timer)
could send the second SMS.
Fix: added second_sms_sent_at IS NOT NULL check to condition 2.
Now manual only moves groups where second SMS was already sent AND client
still didn't agree after 3 more hours.
Also restored 17 groups that were incorrectly moved to manual_required back
to first_sms_sent so second campaign can send their second SMS.
- LogisticsReadinessBoard: @dnd-kit/sortable for drag-and-drop section reordering
- Drag handle (6-dot grip icon) on left of each section header
- Custom order persists in localStorage (key: logistics-section-order)
- Default: agreed → manual_required → funnel order
- Flat rows (no Button/rounded), matches OrdersTable style
- 7 columns: Клиент | Город | Тип | Дата | Водитель | Статус | Обновлён
- Horizontal scroll: overflow-x-auto + min-w-[1080px]
- Type column wide enough for Самовывоз/Доставка in one line
- OrdersTable: widened Type column (minmax 70px→100px), min-w 920→1080px
for consistent horizontal scroll across tables
- SmsCampaignPanel: 4 sub-tabs (first_sms/second_sms/manual/paid_storage)
- 'Проверить снова' button sets needs_check=true in sms_campaign_log
- Auto-refresh every 30s with toggle
- Elapsed time display per row
- Script: after send, notification_status='sms_sending' (not 'link_ready')
→ double protection against re-sending to same group
- Script: get_sms_to_check includes needs_check=true records regardless of age
- Script: checked_at timestamp on each status check
- DB: needs_check boolean + checked_at timestamptz columns added
- test_mode + test_phone columns in sms_campaign_settings (DB)
- Script reads test_mode from DB settings, not env vars
- Admin panel: toggle Test/Production mode with visual indicator
- test_mode=true (default): SMS only to test_phone
- test_mode=false: SMS to real customers
- Service worker cache v9 → v10 (fixes white screen)
- sms_campaign_log table: full audit trail (phone, sms_id, status, code, attempts)
- sms_campaign_settings: editable by megaadmin (wait times, max attempts, delays)
- New tab 'SMS-кампании' in mega_admin navigation
- State machine: no blocking sleeps, fast cron runs
- Protection: no duplicate SMS within 24h, code 231/132 = limit, not retry
- sms_first_campaign.py: full replacement for n8n workflow JnfZwOnpjEazseW5
- sms_campaign_log table: full audit trail in Supabase (visible in admin)
- sms_campaign_settings table: configurable by megaadmin (wait times, attempts, schedule)
- systemd service + timer (NOT activated, ready for deployment)
- Logic: send SMS → wait 25s → check status (102=in transit, 103=delivered)
→ retry check up to 90 min → retry SMS send up to 2 attempts → manual_required
- Telegram notifications after each send/delivery/failure
- Log file: /var/log/supersam-sms-first.log