From 3885f1c51a1d93b25d2be0932e49ab49f38d3e2c Mon Sep 17 00:00:00 2001 From: Mateus Braga Date: Thu, 19 Sep 2024 23:26:31 -0300 Subject: [PATCH] fix --- src/components/Modal.vue | 10 +++++++--- .../matricula/fragments/professorPopover.html | 20 +++++++++---------- src/utils/Matricula.js | 4 ++-- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/components/Modal.vue b/src/components/Modal.vue index 00d5612..5ca77d1 100644 --- a/src/components/Modal.vue +++ b/src/components/Modal.vue @@ -171,10 +171,14 @@ const defaultSortHeaders = computed(() => { }) const transformed = computed(() => { + if (!kicks.value || kicks.value.length === 0) { + return []; + } + return kicks.value.map((kick) => { return Object.assign(kick, { reserva: kick.reserva ? 'Sim' : 'Não', - ik: kick.ik.toFixed(3), + ik: kick.ik && kick.ik.toFixed(3) || kick.ik, }); }); }); @@ -213,7 +217,7 @@ function setupComponents() { nextApi .get(`/entities/components/${componentId}/kicks?studentId=${studentId}`) .then((res) => { - kicks.value = res; + kicks.value = res.data; resort(); loading.value = false; }) @@ -237,7 +241,7 @@ function resort() { oldComponentObject.turno === 'diurno' ? 'asc' : 'desc'; } - kicks.value = _.orderBy(kicks, sortOrder, sortRef); + kicks.value = _.orderBy(kicks.value, sortOrder, sortRef); } function removedFilter(filter) { diff --git a/src/pages/matricula/fragments/professorPopover.html b/src/pages/matricula/fragments/professorPopover.html index e58d320..41bf31e 100644 --- a/src/pages/matricula/fragments/professorPopover.html +++ b/src/pages/matricula/fragments/professorPopover.html @@ -1,11 +1,11 @@
-{{# component.teoria }} - -{{/ component.teoria }} - -{{# component.pratica }} - -{{/ component.pratica }} -
+ {{# component.teoria }} +
Teoria: {{ component.teoria }} +
+ {{/ component.teoria }} + + {{# component.pratica }} +
Prática: {{ component.pratica }} +
+ {{/ component.pratica }} + \ No newline at end of file diff --git a/src/utils/Matricula.js b/src/utils/Matricula.js index 4a51d2d..01d3d02 100644 --- a/src/utils/Matricula.js +++ b/src/utils/Matricula.js @@ -67,7 +67,7 @@ function Matricula() { const searchString = 'todasMatriculas'; let studentId = null; - for (const script of scripts) { + for (const script of Array.from(scripts)) { const content = script.textContent || script.innerHTML; if (content.includes(searchString)) { const regex = /matriculas\[(\d+)\]/; @@ -75,7 +75,7 @@ function Matricula() { if (match && match[1]) { studentId = Number.parseInt(match[1], 10); - return; // Interrompe o loop quando o ID é encontrado + break; // Interrompe o loop quando o ID é encontrado } } }