VA On-Screen Checks

This commit is contained in:
Carl Mahnke
2024-02-28 14:02:31 +01:00
parent 438163217f
commit f955aa24fb
10 changed files with 233 additions and 5 deletions

View File

@@ -0,0 +1,21 @@
import { GebaeudeClient, VerbrauchsausweisWohnenClient } from "#components/Ausweis/types";
import { AuditType, hidden } from "./hidden";
import { prisma } from "@ibcornelsen/database/server";
import { client } from "src/trpc";
import moment from "moment";
import { getKlimafaktoren } from "#lib/Klimafaktoren";
export async function auditKlimaFaktoren(ausweis: VerbrauchsausweisWohnenClient, gebaeude: GebaeudeClient): Promise<boolean> {
if (hidden.has(AuditType.KLIMA_FAKTOREN)) {
return false;
}
if (ausweis.startdatum && gebaeude.plz && ausweis.verbrauch_1) {
const response = await getKlimafaktoren(ausweis.startdatum, gebaeude.plz);
if (!response) {
return true;
}
}
return false;
}