fix(pl24): read MAN category names from mainGroupDescription/groupDescription
Some checks failed
QA Gate (P0/P1) / Test affected app (pull_request) Has been cancelled

MAN truck (p5man) main-vin and sub-vin endpoints return human-readable
names in values.mainGroupDescription and values.groupDescription. Our
parsers only checked the standard caption/description fields used by
VW/Renault/etc., so MAN categories were stored with raw numeric codes
("0", "1", ..., layoutIds like "2884606") as names.

After this change, the user sees proper Turkish names like
"MOTOR, SOĞUTMA SİSTEMLERİ" and "ANTEN". Existing brands fall through
the same field chain as before — captionMatch[2] takes precedence,
keeping their behavior unchanged.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-19 09:10:18 +03:00
parent 1ecc00dfc3
commit 543be19261

View File

@@ -1156,11 +1156,15 @@ export class PL24Service {
values.code ||
String(record.id || record.code || record.hg || "");
// MAN truck main-vin uses values.mainGroupDescription for human name
// (caption above only carries the numeric code "0".."9").
const manDescription = values.mainGroupDescription || values.groupDescription;
let name =
captionMatch?.[2] ||
caption ||
manDescription ||
values.description ||
values.groupDescription ||
caption ||
(record.description as string) ||
(record.name as string) ||
"";
@@ -1169,6 +1173,11 @@ export class PL24Service {
name = caption.replace(/^(\d+|_\w+_)\s*/, "").trim();
}
// If name is just the numeric code (no description found), keep code-only as fallback.
if (name && /^\d+$/.test(name) && manDescription) {
name = manDescription;
}
return {
code,
nameEn: name || code,
@@ -1233,6 +1242,8 @@ export class PL24Service {
values.captions ||
values.caption ||
values.description ||
values.groupDescription ||
values.mainGroupDescription ||
values.name ||
values.title ||
(record.description as string) ||