reduction job, chart duplicates
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-08-25 15:24:20 +02:00
parent 19904bd0ec
commit f57444a3d1
11 changed files with 185 additions and 29 deletions

View File

@ -9,16 +9,6 @@
const faker = require ('faker');
const apps = [];
async function create_app (knex) {
const [ id ] = await knex ('app')
.insert (
{ name: faker.random.word () }
);
apps.push (id);
}
let last_t = 0;
let last_h = 0;
@ -32,7 +22,7 @@ function create_log (timestamp) {
humidity: last_h
};
return {
app_id: faker.random.arrayElement (apps),
app_id: 1,
message: faker.random.words (),
data: JSON.stringify (data),
timestamp
@ -40,15 +30,14 @@ function create_log (timestamp) {
}
async function seed (knex) {
await knex ('log')
.del ();
// eslint-disable-next-line no-console
console.log ('creating seeds');
for (let i = 0; i < 5; i++)
// eslint-disable-next-line no-await-in-loop
await create_app (knex);
const log = (Array (1000))
const log = (Array (10000))
.fill (() => null)
.map (() => faker.date.recent (30))
.map (() => faker.date.recent (60))
.sort ()
.map ((t) => create_log (t));