jsxgraph / moodle-filter_jsxgraph

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

fixed:question.isSolved is not keeping things the way the student submitted them. #35

Closed easyflhomeschool closed 11 months ago

easyflhomeschool commented 12 months ago

dragDollarWallet.txt

I added a file (renamed it txt, however it is an xml file) I want the money to stay where the student 'drops' it on the screen. Can you please let me know if it is a bug or a programming error on my part. Thank you, Wendy

andreas-web commented 11 months ago

Dear Wendy! Thank you for your question. I took a closer look at the XML file and tried it on my Moodle.

If I understand you correctly, you want students to drag the dollar bills into the black box in this question. When they submit the question, you still want the notes to be where they were dragged previously.

This is not possible with your current programming. To "remember" where the bills were positioned, a database entry must be made. For this there is the functionality described here: https://github.com/jsxgraph/moodleformulas_jsxgraph/blob/master/README.md

So my idea for your case would be to expect more answers in the question. The first one is the one that counts and you have already implemented it that way. As memory you would have to create further answers, in which the coordinates of the bills are saved. Of course, these must not be used for the evaluation.

An example, how one could save the coordinates, you can find here: https://github.com/jsxgraph/moodleformulas_jsxgraph/blob/master/README.md#example.

I hope I could help. A change to our code does not seem necessary to me. Therefore I close the issue. If you still have questions, feel free to open it again.

Kind regards, Andreas

easyflhomeschool commented 11 months ago

Thank you Andreas, This is the information I was missing. I appreciate the time you took to look at my question.

On Fri, Jul 21, 2023 at 4:31 AM Andreas W. @.***> wrote:

Dear Wendy! Thank you for your question. I took a closer look at the XML file and tried it on my Moodle.

If I understand you correctly, you want students to drag the dollar bills into the black box in this question. When they submit the question, you still want the notes to be where they were dragged previously.

This is not possible with your current programming. To "remember" where the bills were positioned, a database entry must be made. For this there is the functionality described here: https://github.com/jsxgraph/moodleformulas_jsxgraph/blob/master/README.md

So my idea for your case would be to expect more answers in the question. The first one is the one that counts and you have already implemented it that way. As memory you would have to create further answers, in which the coordinates of the bills are saved. Of course, these must not be used for the evaluation.

An example, how one could save the coordinates, you can find here: https://github.com/jsxgraph/moodleformulas_jsxgraph/blob/master/README.md#example .

I hope I could help. A change to our code does not seem necessary to me. Therefore I close the issue. If you still have questions, feel free to open it again.

Kind regards, Andreas

— Reply to this email directly, view it on GitHub https://github.com/jsxgraph/moodle-filter_jsxgraph/issues/35#issuecomment-1645212052, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARPSPDTRYIMS77E7GLMRC6LXRI44PANCNFSM6AAAAAA2ROSSUU . You are receiving this because you authored the thread.Message ID: @.***>

easyflhomeschool commented 11 months ago

Andreas, I adjusted the question to send back the Y values of the dollars. It still can not get it to show where the student dragged them. I appreciate any feedback you can provide. Wendy Harper

On Fri, Jul 21, 2023 at 7:28 AM Wendy Harper @.***> wrote:

Thank you Andreas, This is the information I was missing. I appreciate the time you took to look at my question.

On Fri, Jul 21, 2023 at 4:31 AM Andreas W. @.***> wrote:

Dear Wendy! Thank you for your question. I took a closer look at the XML file and tried it on my Moodle.

If I understand you correctly, you want students to drag the dollar bills into the black box in this question. When they submit the question, you still want the notes to be where they were dragged previously.

This is not possible with your current programming. To "remember" where the bills were positioned, a database entry must be made. For this there is the functionality described here: https://github.com/jsxgraph/moodleformulas_jsxgraph/blob/master/README.md

So my idea for your case would be to expect more answers in the question. The first one is the one that counts and you have already implemented it that way. As memory you would have to create further answers, in which the coordinates of the bills are saved. Of course, these must not be used for the evaluation.

An example, how one could save the coordinates, you can find here: https://github.com/jsxgraph/moodleformulas_jsxgraph/blob/master/README.md#example .

I hope I could help. A change to our code does not seem necessary to me. Therefore I close the issue. If you still have questions, feel free to open it again.

Kind regards, Andreas

— Reply to this email directly, view it on GitHub https://github.com/jsxgraph/moodle-filter_jsxgraph/issues/35#issuecomment-1645212052, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARPSPDTRYIMS77E7GLMRC6LXRI44PANCNFSM6AAAAAA2ROSSUU . You are receiving this because you authored the thread.Message ID: @.***>

<?xml version="1.0" encoding="UTF-8"?>

Drag-dollars to wallet ($4) (WIP) {name} bought {item} for ${num}.  Drag ${num} to the {location}.
{#A}

]]>
var board = JXG.JSXGraph.initBoard(BOARDID,{ axis:false,grid:false, boundingbox: [0,3,{width},-3], showCopyright: false, showNavigation: false }); board.create('text',[{width}/2,-0.5,'{FB}'],{anchorX:'middle'}); //Display the square board.create('image', ['https://hshonorroll.com/mathGraphics/square_black.png', [.5,-2.5], [{width}-1,5]],{fixed:true,highlight:false}); for (let i=0; i<{num}; i++) { if (i<5){ board.create('image', ['https://hshonorroll.com/mathGraphics/dollar-one.jpg', [(i*2)+2,(i*.25)], [3,1.3]]); } else { board.create('image', ['https://hshonorroll.com/mathGraphics/dollar-one.jpg', [(i*2)-8,((i-4)*.25)-2], [3,1.3]]); }//end if }//end for
{name} bought {item} for ${num}. 
There are {num} dollars in the {location}.
]]>
0.99 0.3333333 0 Your answer is correct. Your answer is partially correct. Your answer is incorrect. abc 0 #A 0.99 0 6 [num,6,6,6,6,6] _err == 0 1 1 //Javascript code to create the construction var jsxCode=function(question){ //initialize the variable var itemsMoved=0; var itemsHalf=0; //Initialize the contruction var board = question.initBoard(BOARDID,{ axis:false, grid:false, boundingbox: [0,3,{width},-3], showCopyright: false, showNavigation: false, pan: { enabled: true, // Allow panning needTwoFingers: true, // panning is done with two fingers on touch devices needShift: true // mouse panning needs pressing of the shift key } }); //turn off infobox board.options.point.showInfobox = false; //Display the square board.create('image', ['https://hshonorroll.com/mathGraphics/square_black.png', [.5,-2.5], [{width}-1,2.5]],{fixed:true,highlight:false}); //add the items to an array var att= {fixed:question.isSolved, snapToGrid: true, withLabel: false}, a=[]; //dollars for (let i=0; i<{numDollars}; i++) { a.push(board.create('image', ['https://hshonorroll.com/mathGraphics/dollar-one.jpg', [{width}/2.5,.5], [3,1.3]],att)); }//end for var calculate=function(){ dollar=0; ten=0; hundred=0; for(let c=0; c<{numDollars}; c++){ if (a[c].Y() <0) { dollar++; }// end if }//end for }//end calculate // Whenever the construction is altered the values of the points are sent to formulas. question.bindInput(0, () => { calculate(); return dollar; });//end bindInput0 question.bindInput(1, () => { if ({numDollars} >0){ ans1=a[0].Y(); }else{ ans1=-10; }//end if return ans1; });//end bindInput1 question.bindInput(2, () => { if ({numDollars} >0){ ans2=a[1].Y(); }else{ ans1=-10; }//end if return ans2; });//end bindInput2 question.bindInput(3, () => { if ({numDollars} >0){ ans3=a[2].Y(); }else{ ans1=-10; }//end if return ans3; });//end bindInput3 question.bindInput(4, () => { if ({numDollars} >0){ ans4=a[3].Y(); }else{ ans1=-10; }//end if return ans4; });//end bindInput4 question.bindInput(5, () => { if ({numDollars} >0){ ans5=a[4].Y(); }else{ ans1=-10; }//end if return ans5; });//end bindInput5 };//end function new JSXQuestion(BOARDID, jsxCode, /* if you want to see inputs: */ true);
${_0} is in the {location}
]]>
andreas-web commented 11 months ago

Dear Wendy.

Please have a look. I have edited your question a little bit. You have to query at the beginning what the last value of the variable was and use this then to position the bills. Then it works!

I also introduced a variable where you can find the correct answer. This consists of [number, '0.5' (as often as there are "superfluous" bills), -2 (as often as there are needed bills)]. At this point you have to work further to implement the whole randomized. But you can do it!

Best regards, Andreas

questions-test-Drag-dollars to wallet ($4) (WIP)-20230726-1132.txt