From 6658e80d998dee5602510713d8bbffb52cd874c0 Mon Sep 17 00:00:00 2001 From: chfhtw Date: Thu, 11 Sep 2025 14:58:20 +0200 Subject: [PATCH] code quality --- .../Stv/Studentenverwaltung/Details/Groups.js | 6 +++--- .../Studentenverwaltung/Details/Groups/Lvb.js | 1 - .../Details/Groups/Special.js | 2 +- .../components/Stv/Studentenverwaltung/List.js | 16 +++++++++++----- .../Stv/Studentenverwaltung/Verband.js | 4 ++-- public/js/directives/draggable.js | 2 +- public/js/directives/drop.js | 4 +--- public/js/helpers/DragAndDrop.js | 18 +++++++++--------- 8 files changed, 28 insertions(+), 25 deletions(-) diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Groups.js b/public/js/components/Stv/Studentenverwaltung/Details/Groups.js index fab9511fe..45c0bf929 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Groups.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Groups.js @@ -142,13 +142,13 @@ export default { } this.$api .call(endpoint) - .then(result => { + .then(() => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); this.$reloadList(); }) .catch(this.$fhcAlert.handleSystemError); }, - addSpecialGroup(params) { + addSpecialGroup() { const gruppe_kurzbz = this.$refs.newGroupModal.value.gruppe_kurzbz || this.$refs.newGroupModal.value; if (Array.isArray(this.modelValue)) { @@ -183,7 +183,7 @@ export default { } else { this.$refs.newGroupModal.$refs.form .call(ApiStvGroups.add(this.modelValue.uid, gruppe_kurzbz, this.currentSemester)) - .then(result => { + .then(() => { this.$refs.newGroupModal.hide(); this.$fhcAlert.alertSuccess(this.$p.t('gruppenmanagement/groups_added', { n: 1 })); this.$refs.list.reload(); diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Groups/Lvb.js b/public/js/components/Stv/Studentenverwaltung/Details/Groups/Lvb.js index db94d359c..8af63323b 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Groups/Lvb.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Groups/Lvb.js @@ -162,7 +162,6 @@ export default { if (this.studiengang_kz === false) return; - let lvbList; this.$api .call(ApiStvLvb.getTree(this.studiengang_kz)) .then(result => this.lvbList = result.data) diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Groups/Special.js b/public/js/components/Stv/Studentenverwaltung/Details/Groups/Special.js index 90b4c15ec..b6d9c8930 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Groups/Special.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Groups/Special.js @@ -45,7 +45,7 @@ export default { this.hide(); } }, - onEnter(evt) { + onEnter() { /** * NOTE(chris): PrimeVue: AutoComplete: Enter does not submit form #5618 * @see https://github.com/primefaces/primevue/issues/5618 diff --git a/public/js/components/Stv/Studentenverwaltung/List.js b/public/js/components/Stv/Studentenverwaltung/List.js index 7c6f57f48..765009060 100644 --- a/public/js/components/Stv/Studentenverwaltung/List.js +++ b/public/js/components/Stv/Studentenverwaltung/List.js @@ -59,8 +59,12 @@ export default { {title:"Vornamen", field:"vornamen", visible:false, headerFilter: true}, {title:"TitelPost", field:"titelpost", headerFilter: "list", headerFilterParams: {valuesLookup:true, listOnEmpty:true, autocomplete:true, sort:"asc"}}, {title:"Ersatzkennzeichen", field:"ersatzkennzeichen", headerFilter: true}, - {title:"Geburtsdatum", field:"gebdatum", formatter:dateFormatter, - headerFilter: true, headerFilterFunc: function(headerValue, rowValue, rowData, filterParams) { + { + title: "Geburtsdatum", + field: "gebdatum", + formatter: dateFormatter, + headerFilter: true, + headerFilterFunc(headerValue, rowValue) { const matches = headerValue.match(/^(([0-9]{2})\.)?([0-9]{2})\.([0-9]{4})?$/); let comparestr = headerValue; if(matches !== null) { @@ -293,11 +297,13 @@ export default { onKeydown(e) { // TODO(chris): this should be in the filter component if (!this.focusObj) return; + + var next; switch (e.code) { case 'Enter': case 'Space': e.preventDefault(); - const e2 = new Event('click', e); + var e2 = new Event('click', e); e2.altKey = e.altKey; e2.ctrlKey = e.ctrlKey; e2.shiftKey = e.shiftKey; @@ -306,13 +312,13 @@ export default { break; case 'ArrowUp': e.preventDefault(); - var next = this.focusObj.previousElementSibling; + next = this.focusObj.previousElementSibling; if (next) this.changeFocus(this.focusObj, next); break; case 'ArrowDown': e.preventDefault(); - var next = this.focusObj.nextElementSibling; + next = this.focusObj.nextElementSibling; if (next) this.changeFocus(this.focusObj, next); break; diff --git a/public/js/components/Stv/Studentenverwaltung/Verband.js b/public/js/components/Stv/Studentenverwaltung/Verband.js index cfa7f0aed..db0070a37 100644 --- a/public/js/components/Stv/Studentenverwaltung/Verband.js +++ b/public/js/components/Stv/Studentenverwaltung/Verband.js @@ -240,7 +240,7 @@ export default { res += ' (' + student.vorname + ' ' + student.nachname + ')'; return res; }, - dropStudents(node, students, evt) { + dropStudents(node, students) { const data = node.data; let endpoint; @@ -335,7 +335,7 @@ export default { :data-tree-item-key="node.key" :title="node.data.studiengang_kz" v-drag-click="() => toggleTreeNode(node)" - v-drop:link-strict.student-collection="(evt, students) => dropStudents(node, students, evt)" + v-drop:link-strict.student-collection="(evt, students) => dropStudents(node, students)" > {{ node.data.name }} diff --git a/public/js/directives/draggable.js b/public/js/directives/draggable.js index 052fcb542..64747c15a 100644 --- a/public/js/directives/draggable.js +++ b/public/js/directives/draggable.js @@ -13,7 +13,7 @@ const EFFECTS = [ ]; export default { - mounted(el, binding, vnode) { + mounted(el, binding) { updateValue(el, binding.value); updateEffectAllowed(el, binding.arg); diff --git a/public/js/directives/drop.js b/public/js/directives/drop.js index 35afa66de..4c50e1b8e 100644 --- a/public/js/directives/drop.js +++ b/public/js/directives/drop.js @@ -7,10 +7,8 @@ const EFFECTS = [ 'none' ]; -let id = 0; - export default { - mounted(el, binding, vnode) { + mounted(el, binding) { const allowedTypes = Object.keys(binding.modifiers); allowedTypes.forEach(type => { if (type.substr(-11) == '-collection') { diff --git a/public/js/helpers/DragAndDrop.js b/public/js/helpers/DragAndDrop.js index 8bf574746..f98697eb2 100644 --- a/public/js/helpers/DragAndDrop.js +++ b/public/js/helpers/DragAndDrop.js @@ -50,20 +50,20 @@ function isValidDragObject(value) { return false; if (value.type.substr(-11) == '-collection') { - if (!value.hasOwnProperty('values')) + if (!Object.prototype.hasOwnProperty.call(value, 'values')) return false; if (!VALID_TYPES.includes(value.type.substr(0, value.type.length-11))) return false; } else { - if (!value.hasOwnProperty('id')) + if (!Object.prototype.hasOwnProperty.call(value, 'id')) return false; if (!VALID_TYPES.includes(value.type)) return false; if (TYPE_DEFINITION[value.type].extras) { - if (!TYPE_DEFINITION[value.type].extras.every(extra => value.hasOwnProperty(extra))) + if (!TYPE_DEFINITION[value.type].extras.every(extra => Object.prototype.hasOwnProperty.call(value, extra))) return false; } } @@ -99,7 +99,7 @@ function getValidTransferData(event, allowedTypes, strict) { return null; } } - } catch(error) { + } catch(_error) { return null; } @@ -175,15 +175,15 @@ function convertToValidDragObject(data, strict) { }); } - if (data.hasOwnProperty('type') && isValidDragObject(data)) { + if (Object.prototype.hasOwnProperty.call(data, 'type') && isValidDragObject(data)) { return data; } - const found = Object.entries(TYPE_DEFINITION).find(([type, typedef]) => { - if (!data.hasOwnProperty(typedef.id)) + const found = Object.entries(TYPE_DEFINITION).find(([ , typedef ]) => { + if (!Object.prototype.hasOwnProperty.call(data, typedef.id)) return false; if (typedef.extras) { - if (!typedef.extras.every(extra => data.hasOwnProperty("extra"))) + if (!typedef.extras.every(extra => Object.prototype.hasOwnProperty.call(data, extra))) return false; } return true; @@ -199,7 +199,7 @@ function convertToValidDragObject(data, strict) { newData.type = type; newData.id = data[typedef.id]; if (typedef.extras) - typedef.extras.forEach(extra => newData[extras] = data[extra]); + typedef.extras.forEach(extra => newData[extra] = data[extra]); return newData; }