jsxgraph / moodle-filter_jsxgraph

moodle plug-in for JSXGraph
https://jsxgraph.org
2 stars 6 forks source link

Students review #19

Closed Bejagui closed 2 years ago

Bejagui commented 3 years ago

Like GeoGebra plugin, when students review their answers, random variables restart; so they can't check why they are wrong.

In fact, I am starting the learning, so I am not sure but I think if I use moodle-filter_jsxgraph the problem exists, but if I use that doesn't ocurre

andreas-web commented 3 years ago

Good morning Bejagui! I don't think I fully understand the problem yet. Would you like a construction to display the changes that were made the first time it was called up in the browser when it was called up for the second time? So the construction should save its state? This is not due to the filter. Even with the manual integration of the jsxgraphcore.js, the JavaScript is reloaded when the page is called up again (which is the whole point of JavaScript). It shows again the state of the construction that the programmer (teacher) has determined. It is possible to save part of the status in the database: With the plugin formulas the current status of the construction is saved when using global variables. Read also: https://github.com/jsxgraph/moodleformulas_jsxgraph The plug-in for this is already included in the latest filter version. Best wishes, Andreas

Bejagui commented 3 years ago

Hi Andreas. The example y attach, is downloaded from Formula qtype course. (I put the code and I attach the results)

Answer Accept buttom Review

code:

Parábola

Usa los deslizadores para indicar la curva de la ecuación: {a}x2 + {b}x + {c} = 0:

(function(myFunction){ var ax = sessionStorage.getItem("as"); var bx = sessionStorage.getItem("bs"); var cx = sessionStorage.getItem("cs"); var Plano = JXG.JSXGraph.initBoard('AT', { boundingbox: [-10.5, 10.5, 10.5, -10.5], axis:true, showCopyright: false, shownavigation: false, zoom: {enabled: false, wheel: false }, pan: { enabled: false, needTwoFingers: false } } ), a = Plano.create('slider',[[2,-5],[7,-5],[-5,ax,5]], {snapWidth:0.25, name:'a'}), b = Plano.create('slider',[[2,-6],[7,-6],[-5,bx,5]], {snapWidth:0.5, name:'b'}), c = Plano.create('slider',[[2,-7],[7,-7],[-5,cx,5]], {snapWidth:0.5, name:'c'}), f = Plano.create('functiongraph',[function(x){ return a.Value()*x*x + b.Value()*x + c.Value(); }]), g = setInterval(function(){ var aa = a.Value(); var bb = b.Value(); var cc = c.Value(); $("input.formulas_number:eq(0):text").val(aa); $("input.formulas_number:eq(1):text").val(bb); $("input.formulas_number:eq(2):text").val(cc); }, 1000); })();

Usa los deslizadores para seleccionar los coeficientes.

{#1}{#2}{#3}

Bejagui commented 3 years ago

In addition, Andreas, can you give me a link where I can to learn about pass of variables JSXGraph-Formula-JSXGraph

Thanks for your time and attention.

andreas-web commented 3 years ago

Dear Bejagui!

As already mentioned, it is quite normal that the page is reloaded when "submitting the form". This will also restart and execute JavaScript. How to use variables in fomulas is explained in this example here: https://github.com/jsxgraph/moodleformulas_jsxgraph/blob/master/README.md#example

andreas-web commented 3 years ago

Hello again! We came up with another possibility: It might be an alternative to save the data in localStorage on the user's device (like a cookie) and to read them again after reloading. Read about the commands here: https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage Best regards, Andreas

Bejagui commented 3 years ago

Very good; thank you