fix(importer): keep first occurrence when an artintro page image repeats (#1433)
Commit: d03ba27bf6e08a3b831a554a673bcc2b9a331e41
Date: 2026-07-06 11:54:09 +0000
Author: PascalHavelange
Commit Message
fix(importer): keep first occurrence when an artintro page image repeats (#1433)
fix(importer): keep first (min n) occurrence when an artintro page image repeats
mwnf3-exhibition-item-importer.ts's importArtintroPageImages wrote one
collection_item pivot row per legacy image row via writeCollectionItem,
which upserts on (collection_id, item_id) via INSERT...ON DUPLICATE KEY
UPDATE. When the same item appears more than once on a page (distinct
`n` grid slots -- e.g. several photos of the same monument), the query
is already ordered by `n` ascending, so whichever occurrence is processed
last silently overwrites the earlier ones -- but legacy always treats the
*first* occurrence (n=1) as the default/featured item shown on page load.
Confirmed concretely in two cases before this fix: the Umayyad Mosque item
on theme 1/page 1 (legacy default) exported with display_order=9 instead
of 1; item M;ISL;es;1;29 on page 9 exported collapsed to display_order=3
instead of 1.
Track seen (collection_id, item_id) pairs and skip subsequent occurrences
instead of re-writing over the first one. Added a regression test
reproducing the Umayyad-Mosque-shaped case (item at n=1, n=5, n=9 on one
page) asserting writeCollectionItem is called exactly once, with the
first occurrence'\''s display_order and picture.
Epic 8 of the islamicart legacy-parity backlog.
Co-authored-by: Pascal HAVELANGE <havelangep@hotmail.com>
Files Changed
- 📝 Modified:
scripts/importer/src/importers/phase-01/mwnf3-exhibition-item-importer.ts - 📝 Modified:
scripts/importer/tests/unit/mwnf3-exhibition-item-importer.test.ts
Links
This documentation was automatically generated from Git commit data.