Actualizar robot.js
This commit is contained in:
5
robot.js
5
robot.js
@@ -400,8 +400,9 @@ async function saveServiceToDB(ownerId, provider, ref, data) {
|
|||||||
console.log(`💾 Guardando/Actualizando ${provider.toUpperCase()} ${ref}...`);
|
console.log(`💾 Guardando/Actualizando ${provider.toUpperCase()} ${ref}...`);
|
||||||
|
|
||||||
// CORRECCIÓN URGENCIA: Miramos en el JSON y convertimos a booleano real
|
// CORRECCIÓN URGENCIA: Miramos en el JSON y convertimos a booleano real
|
||||||
const isUrgent = (data['Urgente'] && data['Urgente'].toLowerCase() === 'sí') ? true : false;
|
const isUrgent = (data['Urgente'] && (data['Urgente'].toLowerCase().trim() === 'sí' || data['Urgente'].toLowerCase().trim() === 'si')) ? true : false;
|
||||||
|
|
||||||
|
|
||||||
// Al añadir is_urgent en la consulta, sincronizamos la columna física de la base de datos
|
// Al añadir is_urgent en la consulta, sincronizamos la columna física de la base de datos
|
||||||
await pool.query(`
|
await pool.query(`
|
||||||
INSERT INTO scraped_services (owner_id, provider, service_ref, raw_data, status, is_urgent)
|
INSERT INTO scraped_services (owner_id, provider, service_ref, raw_data, status, is_urgent)
|
||||||
|
|||||||
Reference in New Issue
Block a user