Files
gomag-vending/api/tests/teardown_test_data.sql
Claude Agent 61ae58ef25 fix: kit discount amount + price sync no auto-insert + repackaging kit detection
Kit discount: v_disc_amt is per-kit, not per-unit — remove division by
v_cantitate_web so discount lines compute correctly (e.g. -2 x 5 = -10).

Price sync: stop auto-inserting missing articles into price policies
(was inserting with wrong proc_tvav from GoMag). Log warning instead.

Kit detection: extend to single-component repackagings (cantitate_roa > 1)
in both PL/SQL package and price sync/validation services.

Add repackaging kit pricing test for separate_line and distributed modes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 11:04:09 +00:00

38 lines
1.3 KiB
SQL

-- Cleanup test data created for Phase 1 validation tests
-- Remove test articles and mappings to leave database clean
-- Remove test price entry
DELETE FROM crm_politici_pret_art WHERE id_pol = 1 AND id_articol = 9999001;
-- Remove test mappings
DELETE FROM ARTICOLE_TERTI WHERE sku IN ('CAFE100', '8000070028685', 'TEST001');
-- Remove test articles (using specific ID_ARTICOL range to avoid removing real data)
DELETE FROM NOM_ARTICOLE WHERE ID_ARTICOL BETWEEN 9999001 AND 9999003;
-- Remove any test orders created during testing (optional - to avoid accumulation)
DELETE FROM COMENZI_ELEMENTE WHERE ID_COMANDA IN (
SELECT ID_COMANDA FROM COMENZI
WHERE NR_COMANDA LIKE 'COMPLETE-%'
OR NR_COMANDA LIKE 'FINAL-TEST-%'
OR NR_COMANDA LIKE 'GOMAG-TEST-%'
OR NR_COMANDA LIKE 'TEST-%'
OR COMANDA_EXTERNA LIKE '%TEST%'
);
DELETE FROM COMENZI
WHERE NR_COMANDA LIKE 'COMPLETE-%'
OR NR_COMANDA LIKE 'FINAL-TEST-%'
OR NR_COMANDA LIKE 'GOMAG-TEST-%'
OR NR_COMANDA LIKE 'TEST-%'
OR COMANDA_EXTERNA LIKE '%TEST%';
-- Remove test partners created during testing (optional)
DELETE FROM NOM_PARTENERI
WHERE DENUMIRE LIKE '%Test%'
AND ID_UTIL = -3
AND DATAORA > SYSDATE - 1; -- Only today's test partners
COMMIT;
PROMPT === Test Data Cleanup Complete ===