reduction job, chart duplicates
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@ -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));
|
||||
|
||||
|
Reference in New Issue
Block a user