// Numbas version: exam_results_page_options {"name": "Jim's copy of Movable syringe JavaScript version", "extensions": ["geogebra"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Jim's copy of Movable syringe JavaScript version", "tags": [], "metadata": {"description": "", "licence": "None specified"}, "statement": "", "advice": "", "rulesets": {}, "extensions": ["geogebra"], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"vol_to_draw": {"name": "vol_to_draw", "group": "Ungrouped variables", "definition": "precround(random(0..1 #0.01 except [0,1]),2)", "description": "", "templateType": "anything", "can_override": false}, "app": {"name": "app", "group": "Ungrouped variables", "definition": "applet()", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["vol_to_draw", "app"], "variable_groups": [], "functions": {"applet": {"parameters": [], "type": "ggbapplet", "language": "javascript", "definition": "// Create the worksheet. \n// This function returns an object with a container `element` and a `promise` resolving to a GeoGebra applet.\nvar params = {\n material_id: 'naewfktn',\n width: 1000,\n height: 500\n};\n\nvar result = Numbas.extensions.geogebra.createGeogebraApplet(params);\n\n// Once the applet has loaded, run some commands to manipulate the worksheet.\nresult.promise.then(function(d) {\n var app = d.app;\n question.applet = d;\n \n function setGGBPoint(name) {\n // moves point in GGB to location of Numbas Vector Variable\n var pt = question.scope.evaluate(name).value\n app.setFixed(name,false,false);\n app.setCoords(name, pt[0], pt[1]);\n app.setFixed(name,true,true);\n }\n\n function setGGBNumber(name) {\n // Sets number in GGB to a Numbas Variable\n var n = question.scope.evaluate(name).value;\n app.setValue(name,n);\n }\n \n app.enableShiftDragZoom(false);\n app.setCoordSystem(-3,23,-5,5);\n app.evalCommand(\"ShowAxes(false)\");\n app.evalCommand(\"ShowGrid(false)\");\n \n var xKggb = app.getValue(\"x(K)\");\n var vol_drawn_raw = (xKggb-11)/10;\n var vol_drawn = Math.round(vol_drawn_raw*100)/100;\n console.log(\"xK = \" + xKggb);\n console.log(\"vol_drawn_raw = \" + vol_drawn_raw);\n console.log(\"vol_drawn = \" + vol_drawn);\n \n});\n\n// This function returns the result of `createGeogebraApplet` as an object \n// with the JME data type 'ggbapplet', which can be substituted into the question's content.\nreturn new Numbas.jme.types.ggbapplet(result);"}, "getGGB": {"parameters": [["val", "string"]], "type": "anything", "language": "javascript", "definition": "return Numbas.exam.currentQuestion.applet.app.getValue(val)"}}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "extension", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "selected_vol_raw:\n getGGB(\"x(K)\")\n\nselected_vol:\n precround((selected_vol_raw-11)/10,2)\n\ntest_val:\n 23.21\n\ntest:\n feedback(\"You have drawn up: \" + selected_vol + \" mL.\")\n\nmark:\n apply(test);\n if(selected_vol=vol_to_draw,\n correct(\"You have drawn \" + vol_to_draw + \" mL correctly using the syringe. Well done.\"),\n incorrect(\"You have not drawn \" + vol_to_draw + \" mL correctly using the syringe.\"))\n\ninterpreted_answer:\n selected_vol", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Use the $1\\thinspace\\mbox{mL}$ syringe below to draw up a volume of $\\var{vol_to_draw}\\thinspace \\mbox{mL}$.

\n

{app}

\n"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Don Shearman", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/680/"}, {"name": "Jim Pettigrew", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2037/"}]}]}], "contributors": [{"name": "Don Shearman", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/680/"}, {"name": "Jim Pettigrew", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2037/"}]}