Merge pull request 'fix(catalog): case-insensitive PL24 group-wid drill check' (#85) from dev into main
Reviewed-on: #85
This commit was merged in pull request #85.
This commit is contained in:
@@ -879,7 +879,15 @@ export class CategoriesService {
|
||||
// parent. If the drill comes back empty, the catalog snapshot is broken
|
||||
// server-side: surface that as a load error instead of a misleading
|
||||
// "no parts" leaf (these group nodes are never legitimately empty).
|
||||
if (category.source === "pl24" && category.linkWid?.includes("Group") && category.vehicleId) {
|
||||
// Case-insensitive: link_wid group tables come capitalised (subGroupsTable)
|
||||
// AND lowercase (groupReferenceTable, groupTable, groupsTable). The old
|
||||
// case-sensitive includes("Group") missed the lowercase ones (~1157 nodes),
|
||||
// so they skipped this group-drill branch and fell to the parts path.
|
||||
if (
|
||||
category.source === "pl24" &&
|
||||
category.linkWid?.toLowerCase().includes("group") &&
|
||||
category.vehicleId
|
||||
) {
|
||||
const groupChildren = await this.getChildren(categoryId);
|
||||
const base = {
|
||||
id: category.id,
|
||||
@@ -1594,7 +1602,8 @@ export class CategoriesService {
|
||||
.from(categories)
|
||||
.where(eq(categories.parentId, root.id));
|
||||
for (const sub of subs) {
|
||||
const isGroup = sub.hasSubgroups === true || sub.linkWid?.includes("Group");
|
||||
const isGroup =
|
||||
sub.hasSubgroups === true || (sub.linkWid?.toLowerCase().includes("group") ?? false);
|
||||
if (!isGroup) continue;
|
||||
const subHit = await drillAndCheck(sub.id);
|
||||
if (subHit) return { code, categoryId: subHit };
|
||||
|
||||
Reference in New Issue
Block a user