// Numbas version: exam_results_page_options {"name": "Louise'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": [{"extensions": [], "parts": [{"showFeedbackIcon": true, "showCorrectAnswer": true, "marks": 0, "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"}}, "prompt": "

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

\n

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

", "variableReplacementStrategy": "originalfirst", "type": "gapfill", "gaps": [{"maxValue": "n", "allowFractions": false, "mustBeReducedPC": 0, "showCorrectAnswer": true, "marks": "0", "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "mustBeReduced": false, "correctAnswerStyle": "plain", "minValue": "n", "correctAnswerFraction": false, "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": false, "variableReplacements": []}, {"maxValue": "2n", "allowFractions": false, "mustBeReducedPC": 0, "showCorrectAnswer": true, "marks": 1, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "mustBeReduced": false, "correctAnswerStyle": "plain", "minValue": "2n", "correctAnswerFraction": false, "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "variableReplacements": [{"must_go_first": false, "part": "p0g0", "variable": "n"}]}], "variableReplacements": []}], "variable_groups": [], "name": "Louise's copy of Access the student's answer to another part in a marking script", "metadata": {"description": "

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

", "licence": "Creative Commons Attribution 4.0 International"}, "variables": {"n": {"definition": "1", "description": "", "name": "n", "group": "Ungrouped variables", "templateType": "anything"}}, "statement": "", "variablesTest": {"condition": "", "maxRuns": 100}, "tags": [], "functions": {}, "rulesets": {}, "preamble": {"js": "", "css": ""}, "ungrouped_variables": ["n"], "advice": "", "type": "question", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Louise Lynch", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2197/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Louise Lynch", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2197/"}]}