Skip to content

Commit 91a6107

Browse files
committed
Laufbahnplanung: Bugfix fehlerhafte Revision
fixes #1886
1 parent 3829686 commit 91a6107

File tree

5 files changed

+26
-43
lines changed

5 files changed

+26
-43
lines changed

svws-webclient/laufbahnplanung/src/components/LadeDaten.vue

+8-33
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<svws-ui-input-wrapper center>
1919
<input type="file" accept=".lp" @change="import_file" :disabled="loading">
2020
<svws-ui-spinner :spinning="loading" />
21-
<br> {{ status === false ? "Fehler beim Import" : status === true ? "Import erfolgreich" : "" }}
21+
<br> {{ (typeof status === "string") ? ("Fehler beim Import: " + status) : ((status === null) ? "Import erfolgreich" : "") }}
2222
</svws-ui-input-wrapper>
2323
<div class="mt-3 -mb-3 opacity-50">
2424
<p class="text-sm text-left">
@@ -65,7 +65,7 @@
6565
6666
const props = defineProps<LadeDatenProps>();
6767
68-
const status = ref<boolean | undefined>(undefined);
68+
const status = ref<string | null | undefined>(undefined);
6969
const loading = ref<boolean>(false);
7070
7171
async function import_file(event: Event) {
@@ -79,14 +79,14 @@
7979
loading.value = true;
8080
const formData = new FormData();
8181
formData.append("data", file);
82-
await props.importLaufbahnplanung(formData);
83-
status.value = true;
82+
status.value = await props.importLaufbahnplanung(formData);
8483
loading.value = false;
8584
}
8685
8786
</script>
8887

8988
<style lang="postcss" scoped>
89+
9090
.login-wrapper {
9191
@apply flex h-full flex-col justify-between;
9292
}
@@ -101,40 +101,15 @@
101101
102102
.login-container {
103103
@apply bg-cover bg-top h-full flex flex-col justify-center items-center px-4;
104-
/*background-image: url('/images/noise.svg'), url('/images/placeholder-background.jpg');
105-
background-size: 100px, cover;
106-
background-blend-mode: overlay, normal;*/
107104
background-image: url('/images/start-hintergrund.jpg');
108-
/*background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.8), transparent 90%),
109-
linear-gradient(to top, #2285d5 0%, transparent 70%),
110-
linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.4) 70%),
111-
#e3eefb;
112-
animation: bg 30s infinite;
113-
114-
&:before {
115-
content: '';
116-
@apply absolute inset-0 pointer-events-none;
117-
background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.5), transparent 60%);
118-
}
119-
120-
&:after {
121-
content: '';
122-
@apply absolute inset-0 opacity-10 pointer-events-none;
123-
background-image: linear-gradient(rgba(255, 255, 255, 1) 2px, transparent 2px), linear-gradient(90deg, rgba(255, 255, 255, 1) 2px, transparent 2px), linear-gradient(rgba(255, 255, 255, 1) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 1) 1px, rgba(255, 255, 255, 0) 1px);
124-
background-size: 50px 50px, 50px 50px, 10px 10px, 10px 10px;
125-
background-position: -2px -2px, -2px -2px, -1px -1px, -1px -1px;
126-
}*/
127105
}
128106
129-
/* @keyframes bg {
130-
0%, 100% { background-color: #2285d5; }
131-
25% { background-color: #8a5cf6; }
132-
50% { background-color: #84cc16; }
133-
75% { background-color: #fff693; }
134-
} */
135-
136107
.modal {
137108
@apply shadow-2xl shadow-black/50 rounded-3xl;
138109
}
139110
111+
input[type="file" i]{ /* the name of the selected file */
112+
@apply w-full;
113+
}
114+
140115
</style>
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export interface LadeDatenProps {
2-
importLaufbahnplanung: (data: FormData) => Promise<void>;
2+
importLaufbahnplanung: (data: FormData) => Promise<string | null>;
33
}

svws-webclient/laufbahnplanung/src/components/LaufbahnplanungOberstufe.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@
129129
}
130130
131131
async function import_laufbahnplanung(formData: FormData) {
132-
await props.importLaufbahnplanung(formData);
133-
return true;
132+
const result = await props.importLaufbahnplanung(formData);
133+
return (result === null);
134134
}
135135
136136
</script>

svws-webclient/laufbahnplanung/src/components/LaufbahnplanungOberstufeProps.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export interface LaufbahnplanungOberstufeProps {
1010
setWahl: (fachID: number, wahl: GostSchuelerFachwahl) => Promise<void>;
1111
setGostBelegpruefungsArt: (value: 'ef1'|'gesamt'|'auto') => Promise<void>;
1212
exportLaufbahnplanung: () => Promise<ApiFile>;
13-
importLaufbahnplanung: (data: FormData) => Promise<void>;
13+
importLaufbahnplanung: (data: FormData) => Promise<string | null>;
1414
schueler: SchuelerListeEintrag,
1515
gostJahrgangsdaten: GostJahrgangsdaten;
1616
gostBelegpruefungsArt: () => 'ef1'|'gesamt'|'auto';

svws-webclient/laufbahnplanung/src/router/apps/RouteData.ts

+14-6
Original file line numberDiff line numberDiff line change
@@ -376,16 +376,24 @@ export class RouteData {
376376
return { data, name };
377377
}
378378

379-
importLaufbahnplanung = async (formData: FormData) => {
379+
importLaufbahnplanung = async (formData: FormData) : Promise<string | null> => {
380380
this.reader.readAll();
381381
const gzData = formData.get("data");
382382
if (!(gzData instanceof File))
383-
return;
383+
return "Es wurde keine gültige Datei angegeben";
384384
const ds = new DecompressionStream("gzip");
385-
const rawData = await (new Response(gzData.stream().pipeThrough(ds))).text();
386-
const laufbahnplanungsdaten = GostLaufbahnplanungDaten.transpilerFromJSON(rawData);
387-
await this.ladeDaten(laufbahnplanungsdaten);
388-
await RouteManager.doRoute(routeLaufbahnplanung.name);
385+
try {
386+
const rawData = await (new Response(gzData.stream().pipeThrough(ds))).text();
387+
const laufbahnplanungsdaten = GostLaufbahnplanungDaten.transpilerFromJSON(rawData);
388+
const revRequired = 1;
389+
if (laufbahnplanungsdaten.lpRevision !== revRequired)
390+
return "Die Revision der Laufbahnplanungsdatei (" + laufbahnplanungsdaten.lpRevision + ") entspricht nicht der unterstützen Revision " + revRequired;
391+
await this.ladeDaten(laufbahnplanungsdaten);
392+
await RouteManager.doRoute(routeLaufbahnplanung.name);
393+
return null; // Kein Fehler
394+
} catch (e) {
395+
return "Fehler beim Laden der Laufbahnplanungsdatei." + ((e instanceof Error) ? ": " + e.message : "");
396+
}
389397
}
390398

391399
get zwischenspeicher(): Abiturdaten | undefined {

0 commit comments

Comments
 (0)