|
|
|
@ -225,7 +225,7 @@ function powerTolerance(target) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function updateDeviation(metricEl, targetEl, warnEl, actual, target, tolerance, unit) {
|
|
|
|
function updateDeviation(metricEl, targetEl, warnEl, actual, target, tolerance, unit) {
|
|
|
|
targetEl.textContent = target != null ? `цель ${target} ${unit}` : "—";
|
|
|
|
targetEl.textContent = target != null ? `${target} ${unit}` : "—";
|
|
|
|
if (actual == null || target == null) {
|
|
|
|
if (actual == null || target == null) {
|
|
|
|
metricEl.classList.remove("metric--off");
|
|
|
|
metricEl.classList.remove("metric--off");
|
|
|
|
warnEl.textContent = "";
|
|
|
|
warnEl.textContent = "";
|
|
|
|
@ -234,10 +234,8 @@ function updateDeviation(metricEl, targetEl, warnEl, actual, target, tolerance,
|
|
|
|
const diff = actual - target;
|
|
|
|
const diff = actual - target;
|
|
|
|
if (Math.abs(diff) > tolerance) {
|
|
|
|
if (Math.abs(diff) > tolerance) {
|
|
|
|
metricEl.classList.add("metric--off");
|
|
|
|
metricEl.classList.add("metric--off");
|
|
|
|
warnEl.textContent = diff > 0 ? "выше цели" : "ниже цели";
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
metricEl.classList.remove("metric--off");
|
|
|
|
metricEl.classList.remove("metric--off");
|
|
|
|
warnEl.textContent = "";
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|