Fix rebuildCatalogOfferIds to preserve correctly set offer_id during import

- Change condition from  to
- Prevents overwriting offer_id that was correctly set to sprite_id during furniture import
- Fixes catalog showing wrong furniture when offer_ids and sprite_ids don't match
This commit is contained in:
openhands committed 2026-08-22 20:52:23 +02:00
1 parent e06e419707
commit 19450d56c5
1 file changed
+3 -2
+3 -2
View File
@@ -671,12 +671,13 @@ export async function rebuildCatalogOfferIds(): Promise<CatalogOfferRebuildResul
for (const row of catalogRows) {
const itemId = Number(String(row.itemIds ?? "").split(/[;,]/)[0]);
if (!Number.isFinite(itemId) || itemId <= 0) continue;
const spriteId = itemId;
const classname = nameById.get(itemId);
const furnidataOffer =
offerById.get(itemId) ??
(classname ? offerByClass.get(classname) : undefined);
const target = furnidataOffer ?? itemId;
if (row.offerId === target) continue;
const target = furnidataOffer ?? spriteId;
if (row.offerId === spriteId) continue;
await db
.update(CatalogItems)
.set({ offerId: target })