-
-
Save parzibyte/b5ef4b70e9a05ca47f7ab67cbc4efad9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let cadena = `INSERT INTO dispositivos_rentados | |
(id_dispositivo, inicio, fin, costo, costo_productos, es_tiempo_libre, cobrado, segundos_pausa, fecha_pausa) | |
VALUES `; | |
const cantidadRegistros = 10; | |
for (let x = 0; x < cantidadRegistros; x++) { | |
const idDispositivo = obtenerNumeroAleatorioEnRango(1, 5); | |
const inicio = fechaAleatoria(); | |
const fin = new Date(inicio.getTime() + (obtenerNumeroAleatorioEnRango(1, 600) * 60 * 1000)); | |
const inicioFormateado = obtenerCadenaFecha(inicio); | |
const finFormateado = obtenerCadenaFecha(fin); | |
const costo = obtenerNumeroAleatorioEnRango(1, 1000); | |
const costoProductos = obtenerNumeroAleatorioEnRango(1, 1000); | |
const esTiempoLibre = obtenerNumeroAleatorioEnRango(0, 1); | |
const cobrado = 1; | |
const segundosPausa = obtenerNumeroAleatorioEnRango(0, 100); | |
const fechaPausa = ""; | |
cadena += ` | |
("${idDispositivo}","${inicioFormateado}", "${finFormateado}", ${costo}, ${costoProductos}, ${esTiempoLibre}, ${cobrado}, ${segundosPausa},"${fechaPausa}")`; | |
if (x + 1 < cantidadRegistros) { | |
cadena += ","; | |
} else { | |
cadena += ";"; | |
} | |
} | |
console.log(cadena); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment