fix(precedent-edit): translate appeal_subtype enum values to Hebrew
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 34s
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 34s
The metadata extractor occasionally stuffs the practice_area enum (``betterment_levy``, ``rishuy_uvniya``, ``compensation_197``) into the free-text ``appeal_subtype`` column. The edit sheet then showed the raw English string in the "תת-סוג" input. When initialising the form, run the value through ``appealSubtypeLabel`` which maps known practice-area enum values to their Hebrew label and returns anything else unchanged. The user can then edit normally; on save the Hebrew sticks, so the next view is also clean.
This commit is contained in:
@@ -35,3 +35,17 @@ export function practiceAreaShort(value: string | null | undefined): string {
|
||||
const match = PRACTICE_AREAS.find((p) => p.value === value);
|
||||
return match ? match.short : value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display label for ``appeal_subtype``. The field is free text — the chair
|
||||
* usually types specific subjects like "תכנית רחביה" or "סופיות ההחלטה" —
|
||||
* but the LLM extractor sometimes mistakenly stuffs the practice_area
|
||||
* enum value (``betterment_levy``, ``rishuy_uvniya``, ``compensation_197``)
|
||||
* in there. When that happens, translate to Hebrew so the UI doesn't
|
||||
* leak English. Otherwise return the value unchanged.
|
||||
*/
|
||||
export function appealSubtypeLabel(value: string | null | undefined): string {
|
||||
if (!value) return "";
|
||||
const enumMatch = PRACTICE_AREAS.find((p) => p.value === value);
|
||||
return enumMatch ? enumMatch.label : value;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user