Verbrauch
-1}
bind:value={ausweis.verbrauch_2}
@@ -259,7 +259,7 @@
Verbrauch
-1}
bind:value={ausweis.verbrauch_3}
@@ -271,7 +271,7 @@
Verbrauch
-1}
@@ -281,7 +281,7 @@
Verbrauch
-1}
@@ -291,7 +291,7 @@
Verbrauch
-1}
diff --git a/src/components/Header.astro b/src/components/Header.astro
index 0f1f0fc6..a4e73a05 100644
--- a/src/components/Header.astro
+++ b/src/components/Header.astro
@@ -61,7 +61,7 @@ const valid = await validateAccessTokenServer(Astro)
Profil
) : (
-
)
diff --git a/src/components/TagInput.svelte b/src/components/TagInput.svelte
index d72e6380..1fe5b894 100644
--- a/src/components/TagInput.svelte
+++ b/src/components/TagInput.svelte
@@ -76,7 +76,8 @@
{/each}
{/if}
- import type { ZIPInformation } from "src/lib/ZIPInformation";
import Label from "./Label.svelte";
+ import { client } from "src/trpc";
+ import type { inferProcedureOutput } from "@trpc/server";
+ import type { AppRouter } from "@ibcornelsen/api";
export let name: string;
export let readonly: boolean = false;
@@ -9,21 +11,22 @@
let hideZipDropdown: boolean = true;
- let zipCodes: ZIPInformation[] = [];
+ let zipCodes: inferProcedureOutput
= [];
async function fetchZipCodeInformation() {
- const result = await fetch(`/api/zip?zip=${zip}`, {
- method: "GET",
- headers: {
- "authorization": "Basic " + btoa("user@ib-cornelsen.de:test")
- }
- }).then(r => r.json());
+ if (!zip || (zip.length < 2)) {
+ return
+ }
- if (result.success === true) {
- zipCodes = result.data;
- if (zipCodes.length > 0) {
+ try {
+ const result = await client.v1.postleitzahlen.query({ plz: zip });
+
+ if (result.length > 0) {
+ zipCodes = result;
hideZipDropdown = false;
}
+ } catch(e) {
+ console.error(e);
}
}
@@ -65,12 +68,12 @@
/>
- {#each zipCodes as {zip: z, city: c}}
+ {#each zipCodes as zipCode}
{
- zip = z;
- city = c;
+ zip = zipCode.plz;
+ city = zipCode.stadt;
hideZipDropdown = true;
- }}>{z}, {c}
+ }}>{zipCode.plz}, {zipCode.stadt}
{/each}
\ No newline at end of file
diff --git a/src/cronjobs/update-dwd-test.ts b/src/cronjobs/update-dwd-test.ts
new file mode 100644
index 00000000..06fc1761
--- /dev/null
+++ b/src/cronjobs/update-dwd-test.ts
@@ -0,0 +1,68 @@
+import moment from "moment";
+import csv from "csvtojson";
+import * as fs from "fs";
+
+const start = moment().set("year", 2019).set("month", 8).set("date", 1);
+
+const end = moment().set("year", 2022).set("month", 10).set("date", 1);
+
+let current = start.clone();
+
+do {
+ const lastYearString = current.clone().startOf("month").format("YYYYMMDD");
+ const nextYearString = current
+ .clone()
+ .subtract(1, "month")
+ .add(1, "year")
+ .endOf("month")
+ .format("YYYYMMDD");
+
+ const filename = `KF_${lastYearString}_${nextYearString}.csv`;
+
+ const url =
+ "https://opendata.dwd.de/climate_environment/CDC/derived_germany/techn/monthly/climate_correction_factor/recent/";
+
+ const response = await fetch(`${url}${filename}`);
+
+ if (response.status !== 200) {
+ console.error(`Could not fetch ${url}${filename}`);
+ process.exit(1);
+ }
+
+ const parser = csv({
+ noheader: false,
+ output: "json",
+ delimiter: ";",
+ });
+
+ const data: {
+ DatAnf: string;
+ DatEnd: string;
+ PLZ: string;
+ KF: string;
+ }[] = await parser.fromString(await response.text());
+
+ const year = current.year();
+ const month = current.month();
+
+ const json = JSON.parse(fs.readFileSync("./test.json", "utf-8"));
+
+ fs.writeFileSync(
+ "./test.json",
+ JSON.stringify(
+ [
+ ...json,
+ ...data.map((row) => [
+ year,
+ month,
+ parseFloat(row.KF),
+ row.PLZ,
+ ]),
+ ],
+ null,
+ 2
+ )
+ );
+
+ console.log(`Wrote ${year}-${month} to file.`);
+} while (current.add(1, "month").isBefore(end));
diff --git a/src/modules/Ausweise/VerbrauchsausweisWohnenModule.svelte b/src/modules/Ausweise/VerbrauchsausweisWohnenModule.svelte
index aacd1ee2..df98898c 100644
--- a/src/modules/Ausweise/VerbrauchsausweisWohnenModule.svelte
+++ b/src/modules/Ausweise/VerbrauchsausweisWohnenModule.svelte
@@ -28,6 +28,9 @@
ausweisart: Enums.Ausweisart.VerbrauchsausweisWohnen
} as VerbrauchsausweisWohnen;
+ console.log(Enums);
+
+
async function ausweisSpeichern() {
// Um einen Ausweis zu speichern müssen wir eingeloggt sein, andernfalls wird die API den call ablehnen.
// Wir prüfen also ob wir eingeloggt sind und leiten den Nutzer ggf. auf die Login Seite weiter.
@@ -207,7 +210,7 @@
@@ -251,14 +254,14 @@
@@ -267,11 +270,11 @@
diff --git a/src/modules/LoginModule.svelte b/src/modules/LoginModule.svelte
index e7936a43..b883d503 100644
--- a/src/modules/LoginModule.svelte
+++ b/src/modules/LoginModule.svelte
@@ -7,7 +7,8 @@
export let redirect: string | null = null;
- async function login() {
+ async function login(e: SubmitEvent) {
+ e.preventDefault()
const response = await loginClient(email, passwort)
if (response === null) {
@@ -31,7 +32,7 @@
diff --git a/src/modules/RegisterModule.svelte b/src/modules/RegisterModule.svelte
index b945ea77..8baa722c 100644
--- a/src/modules/RegisterModule.svelte
+++ b/src/modules/RegisterModule.svelte
@@ -9,7 +9,8 @@
export let redirect: string | null = null;
- async function login() {
+ async function login(e: SubmitEvent) {
+ e.preventDefault()
try {
const response = await client.v1.benutzer.erstellen.mutate({
email,
@@ -23,7 +24,7 @@
return
}
- window.location.href = "/login";
+ window.location.href = "/auth/login";
} catch (e) {
addNotification({
message: "Ups...",
@@ -38,13 +39,14 @@
Registrieren:
-
\ No newline at end of file
diff --git a/src/modules/VerbrauchsausweisGewerbe/VerbrauchsausweisGewerbeModule.svelte b/src/modules/VerbrauchsausweisGewerbe/VerbrauchsausweisGewerbeModule.svelte
index 2d2c2c76..7d88479d 100644
--- a/src/modules/VerbrauchsausweisGewerbe/VerbrauchsausweisGewerbeModule.svelte
+++ b/src/modules/VerbrauchsausweisGewerbe/VerbrauchsausweisGewerbeModule.svelte
@@ -156,8 +156,7 @@