Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/insert_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def insert_data():
if current["weight"] - float(r_data["w"]) > 0.5:
notifications.Feed().push_notification("warning",
"Gewichtsabfall!",
"Das Gewicht ist bei der aktuellen Messung um %skg abgefallen!"
"Das Gewicht ist bei der aktuellen Messung um %sg abgefallen!"
% str(round(float(r_data["w"]) - current["weight"], 2)))
except Exception as e:
print("Error while performing data checks!\n"
Expand Down
6 changes: 3 additions & 3 deletions public/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ async function updateCurrentData(data) {

// Get values for current data displays and round them to 2 decimals
let temperature = Number(latestRecord.temperature).toFixed(2);
let weight = Number(latestRecord.weight).toFixed(3);
let weight = Number(latestRecord.weight).toFixed(2);
let humidity = Number(latestRecord.humidity).toFixed(2);
let weightDelta = getWeightDeltaString(data);

Expand All @@ -196,7 +196,7 @@ async function updateCurrentData(data) {

document.querySelector('main').classList.remove('hide');
document.querySelector('#temperature').innerHTML = temperature + ' °C';
document.querySelector('#weight').innerHTML = weight + ' kg';
document.querySelector('#weight').innerHTML = weight + ' g';
document.querySelector('#weight-delta').innerHTML = weightDelta;
document.querySelector('#humidity').innerHTML = humidity + ' %';
document.querySelector('#updated').innerHTML = measured;
Expand All @@ -222,7 +222,7 @@ function getWeightDeltaString(data) {
// Limit float to 2 decimal places
weightDelta = weightDelta.toFixed(3);
// Format HTML string with green color for weight growth and red color for weight decline
let weightDeltaString = weightDelta >= 0 ? `<p style='color: #8aff6b;'>+${weightDelta} kg</p>` : `<p style='color: #fe7373;'>${weightDelta} kg</p>`;
let weightDeltaString = weightDelta >= 0 ? `<p style='color: #8aff6b;'>+${weightDelta} g</p>` : `<p style='color: #fe7373;'>${weightDelta} g</p>`;
return weightDeltaString;
}

Expand Down
4 changes: 2 additions & 2 deletions public/js/charts.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ async function drawCharts(data) {
*/
async function drawCompareChart(data, separateWeight) {
var compareData = [
['Tag', 'Temperatur (°C)', 'Gewicht (kg)', 'Luftfeuchtigkeit (%)']
['Tag', 'Temperatur (°C)', 'Gewicht (g)', 'Luftfeuchtigkeit (%)']
];

for (row in data) {
Expand Down Expand Up @@ -145,7 +145,7 @@ async function drawTempChart(data) {
* @param {Array} data Array containing the data records that the graph should be generated from
*/
async function drawWeightChart(data) {
var weightData = [['Gemessen', 'Gewicht (kg)']];
var weightData = [['Gemessen', 'Gewicht (g)']];

for (row in data) {
var measured = new Date(data[row].measured);
Expand Down