From dbc6b2cf9e89d2232ddddb3de2cd0e850a8d4b31 Mon Sep 17 00:00:00 2001 From: jorg-vr Date: Fri, 22 Sep 2023 10:09:39 +0200 Subject: [PATCH 1/3] Fix infinite progress bar when filtering students in an evaluation --- app/views/evaluations/show.js.erb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/evaluations/show.js.erb b/app/views/evaluations/show.js.erb index 3be8b2a260..c298baaa15 100644 --- a/app/views/evaluations/show.js.erb +++ b/app/views/evaluations/show.js.erb @@ -1,2 +1,4 @@ dodona.setHTMLExecuteScripts(document.querySelector("#evaluation-table-wrapper"), "<%= escape_javascript(render 'evaluation_table', feedbacks: @feedbacks, evaluation: @evaluation, users: @users) %>") -dodona.setHTMLExecuteScripts(document.querySelector("#evaluation-grade-table-wrapper"), "<%= escape_javascript(render 'evaluation_grade_table', feedbacks: @feedbacks, evaluation: @evaluation, users: @users) %>") +if(document.querySelector("#evaluation-grade-table-wrapper")) { + dodona.setHTMLExecuteScripts(document.querySelector("#evaluation-grade-table-wrapper"), "<%= escape_javascript(render 'evaluation_grade_table', feedbacks: @feedbacks, evaluation: @evaluation, users: @users) %>") +} From c15e5739eb986266caa86ff66431fbf7c7e878f1 Mon Sep 17 00:00:00 2001 From: jorg-vr Date: Fri, 22 Sep 2023 13:22:55 +0200 Subject: [PATCH 2/3] Only run query selector once --- app/views/evaluations/show.js.erb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/views/evaluations/show.js.erb b/app/views/evaluations/show.js.erb index c298baaa15..0130fdaf5d 100644 --- a/app/views/evaluations/show.js.erb +++ b/app/views/evaluations/show.js.erb @@ -1,4 +1,8 @@ dodona.setHTMLExecuteScripts(document.querySelector("#evaluation-table-wrapper"), "<%= escape_javascript(render 'evaluation_table', feedbacks: @feedbacks, evaluation: @evaluation, users: @users) %>") -if(document.querySelector("#evaluation-grade-table-wrapper")) { - dodona.setHTMLExecuteScripts(document.querySelector("#evaluation-grade-table-wrapper"), "<%= escape_javascript(render 'evaluation_grade_table', feedbacks: @feedbacks, evaluation: @evaluation, users: @users) %>") +{ + const gradeTable = document.querySelector("#evaluation-grade-table-wrapper"); + if(gradeTable) { + dodona.setHTMLExecuteScripts(gradeTable, "<%= escape_javascript(render 'evaluation_grade_table', feedbacks: @feedbacks, evaluation: @evaluation, users: @users) %>") + } } + From d916d754308f80984429e91988ddc97a2712978d Mon Sep 17 00:00:00 2001 From: jorg-vr Date: Fri, 22 Sep 2023 13:24:12 +0200 Subject: [PATCH 3/3] Remove extra scoping --- app/views/evaluations/show.js.erb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/views/evaluations/show.js.erb b/app/views/evaluations/show.js.erb index 0130fdaf5d..4ba37586ce 100644 --- a/app/views/evaluations/show.js.erb +++ b/app/views/evaluations/show.js.erb @@ -1,8 +1,6 @@ dodona.setHTMLExecuteScripts(document.querySelector("#evaluation-table-wrapper"), "<%= escape_javascript(render 'evaluation_table', feedbacks: @feedbacks, evaluation: @evaluation, users: @users) %>") -{ - const gradeTable = document.querySelector("#evaluation-grade-table-wrapper"); - if(gradeTable) { - dodona.setHTMLExecuteScripts(gradeTable, "<%= escape_javascript(render 'evaluation_grade_table', feedbacks: @feedbacks, evaluation: @evaluation, users: @users) %>") - } +const gradeTable = document.querySelector("#evaluation-grade-table-wrapper"); +if(gradeTable) { + dodona.setHTMLExecuteScripts(gradeTable, "<%= escape_javascript(render 'evaluation_grade_table', feedbacks: @feedbacks, evaluation: @evaluation, users: @users) %>") }