// Numbas version: exam_results_page_options {"name": "Adrian's copy of Access the student's answer to another part in a marking script", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"ungrouped_variables": ["n"], "variablesTest": {"maxRuns": 100, "condition": ""}, "name": "Adrian's copy of Access the student's answer to another part in a marking script", "extensions": [], "parts": [{"prompt": "

Write a number in the first box: [[0]]

\n

Write double that number in the second box: [[1]]

", "type": "gapfill", "variableReplacementStrategy": "originalfirst", "gaps": [{"mustBeReducedPC": 0, "correctAnswerFraction": false, "maxValue": "n", "minValue": "n", "variableReplacements": [], "showCorrectAnswer": true, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "allowFractions": false, "marks": "0", "mustBeReduced": false, "scripts": {}, "showFeedbackIcon": false}, {"mustBeReducedPC": 0, "correctAnswerFraction": false, "maxValue": "2n", "minValue": "2n", "variableReplacements": [{"variable": "n", "part": "p0g0", "must_go_first": false}], "showCorrectAnswer": true, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "allowFractions": false, "marks": 1, "mustBeReduced": false, "scripts": {}, "showFeedbackIcon": true}], "variableReplacements": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {"mark": {"script": "// Get the student's answer to the first gap.\n// This is a JME token. Since the first gap is a number entry, it's a TNum object.\nvar studentN = part.question.getPart('p0g0').studentAnswerAsJME();\n\n// Unwrap the JME token to get a JavaScript number.\nstudentN = Numbas.jme.unwrapValue(studentN);\n\n// Now we can do something with the number.\n// For this example, I'll just add a marking comment saying what the number was.\nthis.markingComment(\"In the first part you wrote \"+studentN+\".\");", "order": "after"}}, "marks": 0}], "statement": "", "tags": [], "type": "question", "variables": {"n": {"name": "n", "group": "Ungrouped variables", "templateType": "anything", "description": "", "definition": "1"}}, "variable_groups": [], "advice": "", "rulesets": {}, "functions": {}, "preamble": {"js": "", "css": ""}, "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Shows how to retrieve the student's answer to another part from a custom marking script.

"}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Adrian Jannetta", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/164/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Adrian Jannetta", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/164/"}]}