X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fviews%2FHall.vue;h=c8ca3e6d3863c1bc700d698e9ca489c72a6b7df0;hb=2a2936023cda0888e215ff699d420090372899b0;hp=c3c812820e968c2dae1af62746e3459d70154aff;hpb=ce37466ee16c39bf19832524793a23d40915de93;p=vchess.git diff --git a/client/src/views/Hall.vue b/client/src/views/Hall.vue index c3c81282..c8ca3e6d 100644 --- a/client/src/views/Hall.vue +++ b/client/src/views/Hall.vue @@ -1097,16 +1097,18 @@ export default { } window.V = this.newchallenge.V; let chall = Object.assign({}, this.newchallenge, { options: {} }); - // Get/set options variables (if any) / TODO: v-model?! - for (const check of this.newchallenge.V.Options.check || []) { - const elt = document.getElementById(check.variable + "_opt"); - chall.options[check.variable] = elt.checked; - } - for (const select of this.newchallenge.V.Options.select || []) { - const elt = document.getElementById(select.variable + "_opt"); - const tryIntVal = parseInt(elt.value, 10); - chall.options[select.variable] = - (isNaN(tryIntVal) ? elt.value : tryIntVal); + if (V.Options) { + // Get/set options variables (if any) / TODO: v-model?! + for (const check of this.newchallenge.V.Options.check || []) { + const elt = document.getElementById(check.variable + "_opt"); + chall.options[check.variable] = elt.checked; + } + for (const select of this.newchallenge.V.Options.select || []) { + const elt = document.getElementById(select.variable + "_opt"); + const tryIntVal = parseInt(elt.value, 10); + chall.options[select.variable] = + (isNaN(tryIntVal) ? elt.value : tryIntVal); + } } error = checkChallenge(chall); if (error) { @@ -1134,7 +1136,7 @@ export default { alert(this.st.tr["Challenge already exists"]); return; } - if (this.newchallenge.memorize) this.addPresetChall(this.newchallenge); + if (this.newchallenge.memorize) this.addPresetChall(chall); delete chall["V"]; delete chall["diag"]; const finishAddChallenge = cid => {