Derive catalog offer_id from furnidata sprite id
CI / check (push) Successful in 44s
CI / release (push) Skipped
CI / deploy (push) Successful in 1m19s

Import used a hardcoded offer_id of -1, while the matching
FurnitureData.json entry already carries offerid = spriteId.
Set catalog_items.offer_id to the sprite id on insert and update so
purchases resolve to the correct furni offer.
This commit is contained in:
openhands committed 2026-08-18 19:34:34 +02:00
1 parent 7257a7b0f4
commit 305a0c42ff
1 file changed
+2 -2
+2 -2
View File
@@ -783,7 +783,7 @@ export async function importSingleFurni(params: {
const price = autoPriceFurni(classname);
await db.execute(sql`
UPDATE catalog_items
SET page_id = ${pageIdStr}, cost_credits = ${price.credits}, cost_points = ${price.points}, points_type = ${price.pointsType}
SET page_id = ${pageIdStr}, cost_credits = ${price.credits}, cost_points = ${price.points}, points_type = ${price.pointsType}, offer_id = ${spriteId}
WHERE id = ${catalogItemId}
`);
catalogUpdated = true;
@@ -803,7 +803,7 @@ export async function importSingleFurni(params: {
catalogItemId = await allocateCatalogItemId(async (nextCatalogId) => {
await db.execute(sql`
INSERT INTO catalog_items (id, page_id, item_ids, catalog_name, cost_credits, cost_points, points_type, amount, order_number, offer_id, extradata)
VALUES (${nextCatalogId}, ${pageIdStr}, ${itemIdStr}, ${classname}, ${price.credits}, ${price.points}, ${price.pointsType}, 1, 1, '-1', '')
VALUES (${nextCatalogId}, ${pageIdStr}, ${itemIdStr}, ${classname}, ${price.credits}, ${price.points}, ${price.pointsType}, 1, 1, ${spriteId}, '')
`);
return nextCatalogId;
});