Commit 36e54d39 authored by Jasper Verbeet's avatar Jasper Verbeet 🙇🏻

Fixes

parent 9acc94b7
{"status":true,"origin":"Eindhoven","destination":"Helsinki","width":233,"height":300,"depth":300,"weight":5000,"new":false,"opened":true,"added_time":123,"current_weight":5000}
\ No newline at end of file
{"status":false,"origin":"Eindhoven","destination":"Helsinki","width":233,"height":300,"depth":300,"weight":5000,"new":false,"opened":true,"added_time":123,"current_weight":5000}
\ No newline at end of file
......@@ -87,11 +87,12 @@ app.get('/api/notification', (req, res) => {
console.log(colors.magenta(`${new Date().toLocaleString()} Polling from app`));
if (!newItem) {
const weightNum = getDbItem('weight') || 0;
const currentWeightNum = getDbItem('current_weight') || 1;
const weightNum = int(getDbItem('weight')) || 0;
const currentWeightNum = int(getDbItem('current_weight')) || 1;
const weight = `${weightNum} kg`;
const currentWeight = scale(currentWeightNum, 0, 10000, 0, 1);
const newWeight = scale(currentWeightNum + weightNum, 0, 10000, 0, 1);
const increase = `${Math.round((newWeight / currentWeight) * 100)}%`;
const size = `${getDbItem('width')} x ${getDbItem('height')} x ${getDbItem('depth')} cm`;
const time = getDbItem('added_time') | 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment