Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSXGRaph Object not reinitialised after student submission #1387

Open
joel-scott opened this issue Feb 9, 2025 · 1 comment
Open

JSXGRaph Object not reinitialised after student submission #1387

joel-scott opened this issue Feb 9, 2025 · 1 comment

Comments

@joel-scott
Copy link

As per the post here, it would be great if when a student submitted their work, there was some capacify to change a jsxgraph object from 'question mode' to 'feedback mode'.

In my example I've written the jsxgraph so that if feedbackTime == 0 the diagram is drawn one way ('question mode') and if feedbackTime == 1 it's drawn with feedback on it.

This feels less clunky than keeping the original diagram and adding in additional jsxgraph objects in the feedback as I've done int he past.

Issue is that changing that variable from 0 to 1 in the prt does not lead to the jsxgraph object re-drawing with the new value of that variable.

@aharjula
Copy link
Member

aharjula commented Feb 10, 2025

"JSXGRaph Object not reinitialised after student submission" is quite the statement, I do assume the graph is still being drawn no matter what the student submits. In any case, I assume that this is basically issue #1101, to paraphrase:

  1. One cannot access a graph of the question-text from the feedback-logic, due to the new security system. Actually, you cannot access any [[js*]] directly from anywhere. Message passing between such sandboxes needs to be constructed through specific interfaces, and we don't provide many of those.
  2. The graph can, however, access various selected things and decide to do things based on what it sees.
  3. The simple way is to output named elements (e.g. empty divs with particular IDs) in the PRT-feedback and then use logic inside the graph to detect if those have been outputted and draw something based on their existence.
  4. Alternatively, one can have a hidden input somewhere and use it as a communication channel for logi coming from the PRT or just from some centralised input-tied logic present in some other sandbox-iframe. This is essentially the "flags" thing in the comments of Marking the JsxGraph from the question #1101.
  5. And finally, if one only wants to know if the question is closed, one can check if the inputs are read-only and react to that.

Depending on what exactly one means by submitting and "feedback mode" and whether one wants to construct the plotted thing based on CAS-evaluated details of the student's answer, the solution to use can vary. If we actually want to transfer something constructed from the answer in CAS then things get complicated, but not impossible, it just means that one needs to read the contents of some named elements (as in 3.) and work with those. Note that no one is blocking you from having actual JavaScript as those contents and using eval() in the sandbox to execute it, but your VLE might mangle that script during output, and that might be a difficult fight to win as output filtering can change during Moodle etc. updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants