Notifications + Plausibilitätsprüfung
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import { Gebaeude } from "src/lib/Gebaeude";
|
||||
import { AuditType, hidden } from "./hidden";
|
||||
|
||||
export function auditVerbrauchAbweichung(gebaeude: Gebaeude): number[] {
|
||||
let ausweis = gebaeude.ausweis;
|
||||
if (!ausweis || gebaeude.leerstand > 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (hidden.has(AuditType.VERBRAUCH_ABWEICHUNG)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
if (getAbweichung(ausweis.kennwerte.verbrauch_1, ausweis.kennwerte.verbrauch_2) > 0.25) {
|
||||
return [1, 2];
|
||||
}
|
||||
|
||||
if (getAbweichung(ausweis.kennwerte.verbrauch_2, ausweis.kennwerte.verbrauch_3) > 0.25) {
|
||||
return [2, 3];
|
||||
}
|
||||
|
||||
if (getAbweichung(ausweis.kennwerte.verbrauch_4, ausweis.kennwerte.verbrauch_5) > 0.25) {
|
||||
return [4, 5];
|
||||
}
|
||||
|
||||
if (getAbweichung(ausweis.kennwerte.verbrauch_5, ausweis.kennwerte.verbrauch_6) > 0.25) {
|
||||
return [5, 6];
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
function getAbweichung(x: number, y: number): number {
|
||||
console.log(x, y, Math.abs((x - y) / ((x + y) / 2)));
|
||||
|
||||
return Math.abs((x - y) / ((x + y) / 2));
|
||||
}
|
||||
Reference in New Issue
Block a user