mirror of
https://github.com/catdevnull/preciazo.git
synced 2025-02-22 14:46:28 +00:00
improve
This commit is contained in:
parent
8da80120d8
commit
ad9d2b15c2
2 changed files with 24 additions and 14 deletions
|
@ -8,11 +8,11 @@ CREATE SEQUENCE seq_datasets START 1;
|
|||
|
||||
|
||||
CREATE TABLE precios (
|
||||
id_dataset INTEGER,
|
||||
id_comercio INTEGER,
|
||||
id_bandera INTEGER,
|
||||
id_sucursal INTEGER,
|
||||
id_producto BIGINT,
|
||||
id_dataset INTEGER not null,
|
||||
id_comercio INTEGER not null,
|
||||
id_bandera INTEGER not null,
|
||||
id_sucursal INTEGER not null,
|
||||
id_producto BIGINT not null,
|
||||
productos_ean INTEGER,
|
||||
productos_descripcion TEXT,
|
||||
productos_cantidad_presentacion DECIMAL(10,2),
|
||||
|
@ -36,16 +36,16 @@ CREATE TABLE productos_descripcion_index (
|
|||
);
|
||||
|
||||
CREATE TABLE sucursales (
|
||||
id_dataset INTEGER,
|
||||
id_comercio INTEGER,
|
||||
id_bandera INTEGER,
|
||||
id_sucursal INTEGER,
|
||||
id_dataset INTEGER not null,
|
||||
id_comercio INTEGER not null,
|
||||
id_bandera INTEGER not null,
|
||||
id_sucursal INTEGER not null,
|
||||
sucursales_nombre TEXT,
|
||||
sucursales_tipo TEXT,
|
||||
sucursales_calle TEXT,
|
||||
sucursales_numero TEXT,
|
||||
sucursales_latitud DECIMAL,
|
||||
sucursales_longitud DECIMAL,
|
||||
sucursales_latitud DECIMAL(18, 15),
|
||||
sucursales_longitud DECIMAL(18, 15),
|
||||
sucursales_observaciones TEXT,
|
||||
sucursales_barrio TEXT,
|
||||
sucursales_codigo_postal TEXT,
|
||||
|
@ -63,7 +63,7 @@ CREATE TABLE sucursales (
|
|||
);
|
||||
|
||||
CREATE TABLE banderas (
|
||||
id_dataset INTEGER,
|
||||
id_dataset INTEGER not null,
|
||||
id_comercio INTEGER NOT NULL,
|
||||
id_bandera INTEGER NOT NULL,
|
||||
comercio_cuit TEXT NOT NULL,
|
||||
|
|
|
@ -76,8 +76,18 @@ async function importSucursales(connection, datasetId, dir) {
|
|||
appender.appendVarchar(data.sucursales_tipo);
|
||||
appender.appendVarchar(data.sucursales_calle);
|
||||
appender.appendVarchar(data.sucursales_numero);
|
||||
appender.appendInteger(parseFloat(data.sucursales_latitud));
|
||||
appender.appendInteger(parseFloat(data.sucursales_longitud));
|
||||
/** @type {[number, number]} */
|
||||
let [lat, lon] = [
|
||||
parseFloat(data.sucursales_latitud),
|
||||
parseFloat(data.sucursales_longitud),
|
||||
];
|
||||
if (isNaN(lat) || isNaN(lon)) {
|
||||
appender.appendNull();
|
||||
appender.appendNull();
|
||||
} else {
|
||||
appender.appendDouble(lat);
|
||||
appender.appendDouble(lon);
|
||||
}
|
||||
appender.appendVarchar(data.sucursales_observaciones);
|
||||
appender.appendVarchar(data.sucursales_barrio);
|
||||
appender.appendVarchar(data.sucursales_codigo_postal);
|
||||
|
|
Loading…
Reference in a new issue