data routes done
This commit is contained in:
@ -28,7 +28,6 @@ async function seedSensorData(seedOptions) {
|
||||
}
|
||||
|
||||
await sensorDataModel.bulkCreate(rows)
|
||||
//console.log(rows);
|
||||
}
|
||||
|
||||
function convertDateToUTC(startDate) {
|
||||
@ -85,6 +84,22 @@ function numberWithinPercent(inputNumber) {
|
||||
|
||||
return Math.floor(newNumber);
|
||||
}
|
||||
/*
|
||||
function randomizeDataPoint(value, delta, maxDelta){
|
||||
// https://stackoverflow.com/a/36756480
|
||||
delta = Math.random() < 0.9 ? delta : maxDelta
|
||||
return Math.floor(Math.random() * ((value+delta) - Math.abs(delta-value)) + Math.abs(delta-value));
|
||||
}
|
||||
|
||||
let count = 0
|
||||
let currentValue = 85
|
||||
while(count <50){
|
||||
count++
|
||||
console.log(currentValue)
|
||||
currentValue = randomizeDataPoint(currentValue, 2, 5)
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
//add seed
|
||||
router.post("/new", async (req, res, next) => {
|
||||
@ -115,18 +130,6 @@ POST /api/v0/seed/sensordata
|
||||
2) nextDataRow(lastRow, interval)
|
||||
3) seedSensorData({post object from abovr})
|
||||
|
||||
function randomizeDataPoint(value, delta, maxDelta){
|
||||
// https://stackoverflow.com/a/36756480
|
||||
delta = Math.random() < 0.9 ? delta : maxDelta
|
||||
return Math.floor(Math.random() * ((value+delta) - Math.abs(delta-value)) + Math.abs(delta-value));
|
||||
}
|
||||
|
||||
let count = 0
|
||||
let currentValue = 85
|
||||
while(count <50){
|
||||
count++
|
||||
console.log(currentValue)
|
||||
currentValue = randomizeDataPoint(currentValue, 2, 5)
|
||||
}
|
||||
|
||||
*/
|
||||
|
@ -8,8 +8,6 @@ const {
|
||||
getSensorDataById,
|
||||
getData,
|
||||
getDatabyRange,
|
||||
getdataFilter,
|
||||
getAverage,
|
||||
} = require("../functions/apiDatabase.js");
|
||||
|
||||
const express = require("express");
|
||||
|
Reference in New Issue
Block a user