fix CSV importer AP/orientation name resolution + seed missing AP programs

- migration 014: adds Récits et expérimentation (RE), PACS, sets code NS
  on Narration Spéculative; applied to both posterg.db and test.db

- importer (admin/index.php): replaced the code-only ap_programs lookup
  (SELECT WHERE code=?) and the orientationMap short-code translation with
  two resolver closures that handle the real CSV format (full names):

  resolveAP(): alias map for L.I.E.N.S., case variants → exact name
  match → code match (legacy) → case-insensitive name match

  resolveOrientation(): legacy 2-letter code map → alias map for
  Installation/Performance, Arts numériques, Design numérique →
  exact name match → case-insensitive name match

  All 5 AP values and 13 orientation values from the real CSV now
  resolve to correct DB IDs. Legacy short-code CSVs (test.db format)
  continue to work unchanged.
This commit is contained in:
Pontoporeia
2026-04-21 19:16:52 +02:00
parent 73fdda4a7f
commit 19ef2a11dc
6 changed files with 104 additions and 15 deletions

View File

@@ -0,0 +1 @@
,padlock,archlinux,21.04.2026 19:12,file:///home/padlock/.config/libreoffice/4;

View File

@@ -0,0 +1,9 @@
-- Migration 014: seed missing AP programs and fix codes
-- Adds programs present in real CSV data but absent from the initial seed.
-- Fill in missing code for Narration Spéculative
UPDATE ap_programs SET code = 'NS' WHERE name = 'Narration Spéculative' AND (code IS NULL OR code = '');
-- Add missing AP programs (INSERT OR IGNORE is safe to re-run)
INSERT OR IGNORE INTO ap_programs (name, code) VALUES ('Récits et expérimentation', 'RE');
INSERT OR IGNORE INTO ap_programs (name, code) VALUES ('PACS', 'PACS');

Binary file not shown.

Binary file not shown.