Fix slug validation and park type detection

This commit is contained in:
gpt-engineer-app[bot]
2025-10-17 15:51:37 +00:00
parent ac151e5445
commit f5ee267e66
2 changed files with 4 additions and 4 deletions

View File

@@ -48,7 +48,7 @@ export function ValidationSummary({ item, onValidationChange, compact = false }:
const result = await validateEntityData(
item.item_type as ValidEntityType,
{ ...item.item_data, id: item.id }
{ ...item.item_data, id: item.item_data.id || item.id }
);
setValidationResult(result);

View File

@@ -518,15 +518,15 @@ function shouldTrackField(key: string): boolean {
/**
* Normalizes values for consistent comparison
* Handles enum-like strings (snake_case) by ensuring lowercase
* Handles enum-like strings (snake_case and Title Case) by ensuring lowercase
*/
function normalizeForComparison(value: any): any {
// Null/undefined pass through
if (value == null) return value;
// Normalize enum-like strings to lowercase for comparison
// Matches patterns like: "operating", "Operating", "amusement_park", "Amusement_Park"
if (typeof value === 'string' && /^[a-zA-Z_]+$/.test(value)) {
// Matches patterns like: "operating", "Operating", "amusement_park", "Amusement_Park", "Amusement Park"
if (typeof value === 'string' && /^[a-zA-Z_\s]+$/.test(value)) {
return value.toLowerCase().trim();
}