apluslms/mooc-grader

The editor used in the tietokannat course is broken

jaguarfi opened this issue · 5 comments

After A+ update, the editor which is used to write relational algebra expressions seems not to work. For example, if you go to CS-1150 summer course 2020 and choose Exercise Round 1, Problem 1 and try to write the answer pushing any of the buttons for different operators does not produce any result. I have tried with Firefox and Chrome. These properties used to work without any problems before the update.

Writing the expression yourself with letters (keys) still works, but that is too tedious for the students.

This editor is essential for our course. The course starts on February 8th.

Kerttu

The editor used in the Tietokannat course is broken due to some changes added in the commit 6dde039 and more specifically in the line 46

The editor used in the aforementioned course selects the <textarea> element by using the jquery selector $('#id_answer") which unfortunately is changed by line 46

One solution can be to add some validations before changing the id value, here in the mooc-grader, or use the name parameter to select the <textarea> element in the editor.js file used in the Tietokannat course

Editor
image

@jaguarfi perhaps this JS click event handler bug breaks the JavaScript in this course too. At first, I think it is likely.
apluslms/a-plus#736

I am not really sure, the editor uses buttons and therefore the event handler will not respond to the button click. Moreover, the error I found in the google developer console shows that the id="id_answer" in the <textarea> element is not found. What I found is that the id is changed to values, such as id="exercise-QUFIjB5k-answer" and id="exercise-T1hpuEuH-answer". I verified with version 1.7 of the mooc-grader and the id remains the same, i.e., id="id_answer", so I am pretty sure that the error is introduced in the line 46

@jaguarfi yes indeed. The course configuration defines the field names like answer. In A+ v1.7, that guaranteed the form HTML id id_answer, but now in A+ v1.8, the HTML ids have a randomized part. Could the JavaScript in the Databases course be changed so that it will find all elements with id exercise-*-answer where * is not known?

This commit[Internal link] should fix this issue.

@jaguarfi Great! You can close this issue when you think the course JS code has been fixed and git-pushed.