mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 12:11:17 -05:00
Fix slug validation and park type detection
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user