Actualizar robot.js

This commit is contained in:
2026-03-17 21:58:20 +00:00
parent f291a0e198
commit c381092647

View File

@@ -16,6 +16,21 @@ function normalizarTexto(texto) {
return texto.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, ""); return texto.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "");
} }
// 🛠️ NUEVO: El "Gira-Nombres" EXCLUSIVO para HomeServe
function arreglarNombre(nombreRaw) {
if (!nombreRaw) return "";
let nombreLimpio = nombreRaw.trim();
// Si detectamos que tiene una coma...
if (nombreLimpio.includes(',')) {
let partes = nombreLimpio.split(',');
let apellidos = partes[0].trim();
let nombre = partes[1].trim();
// Le damos la vuelta y quitamos espacios sobrantes
nombreLimpio = `${nombre} ${apellidos}`.replace(/\s+/g, ' ');
}
return nombreLimpio;
}
// NUEVO: La función ahora lee las keywords directamente del JSON de la base de datos // NUEVO: La función ahora lee las keywords directamente del JSON de la base de datos
function clasificarGremio(descripcion, gremiosActivosDB) { function clasificarGremio(descripcion, gremiosActivosDB) {
if (!descripcion || gremiosActivosDB.length === 0) return null; if (!descripcion || gremiosActivosDB.length === 0) return null;
@@ -379,26 +394,6 @@ async function syncAndArchive(ownerId, provider, currentWebRefs) {
} }
} }
function normalizarTexto(texto) {
if (!texto) return "";
return texto.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "");
}
// 🛠️ NUEVO: El "Gira-Nombres" EXCLUSIVO para HomeServe
function arreglarNombre(nombreRaw) {
if (!nombreRaw) return "";
let nombreLimpio = nombreRaw.trim();
// Si detectamos que tiene una coma...
if (nombreLimpio.includes(',')) {
let partes = nombreLimpio.split(',');
let apellidos = partes[0].trim();
let nombre = partes[1].trim();
// Le damos la vuelta y quitamos espacios sobrantes
nombreLimpio = `${nombre} ${apellidos}`.replace(/\s+/g, ' ');
}
return nombreLimpio;
}
async function saveServiceToDB(ownerId, provider, ref, data) { async function saveServiceToDB(ownerId, provider, ref, data) {
console.log(`💾 Guardando/Actualizando ${provider.toUpperCase()} ${ref}...`); console.log(`💾 Guardando/Actualizando ${provider.toUpperCase()} ${ref}...`);