feat: schoolist splits only once

This commit is contained in:
Sebastian Pravda 2023-02-04 15:17:57 +01:00
parent 9932ce87b7
commit 3a9b479934
No known key found for this signature in database
GPG key ID: F3BC84F08EFA3F57
2 changed files with 6 additions and 4 deletions

View file

@ -1,11 +1,10 @@
<script lang="ts">
import LL from '$i18n/i18n-svelte';
import schoollistString from '$lib/assets/schoollist.txt?raw';
import School from './School.svelte';
import type { School as SchoolType } from '$lib/stores/candidate';
const schoolList: Array<string> = schoollistString.split(';');
export let schoolList: Array<string>;
let filteredSchools: Array<string> = [];

View file

@ -33,6 +33,7 @@
let pagesFilled = [false, false, false, false, false, false, false, false];
const editModePageIndex = 3;
const pageCount = pagesFilled.length;
const schoolList: Array<string> = schoollistString.split(';');
let pageTexts = [
$LL.candidate.register.second.title(),
@ -152,7 +153,7 @@
.required()
.test((_val) => {
if (!_val) return false;
return schoollistString.split(';').includes(_val);
return schoolList.includes(_val);
}),
field: yup.string().required()
}),
@ -162,7 +163,7 @@
.required()
.test((_val) => {
if (!_val) return false;
return schoollistString.split(';').includes(_val);
return schoolList.includes(_val);
}),
field: yup.string().required()
}),
@ -745,6 +746,7 @@
První škola - termín JPZ: <span class="underline">13. 4. 2023</span>
</h2>
<SchoolSelect
schoolList={schoolList}
error={$typedErrors['candidate']['firstSchool']['name'] ||
$typedErrors['candidate']['firstSchool']['field']}
bind:selectedSchool={$form.candidate.firstSchool}
@ -768,6 +770,7 @@
Druhá škola - termín JPZ: <span class="underline">14. 4. 2023</span>
</h2>
<SchoolSelect
schoolList={schoolList}
error={$typedErrors['candidate']['secondSchool']['name'] ||
$typedErrors['candidate']['secondSchool']['field']}
bind:selectedSchool={$form.candidate.secondSchool}