// Numbas version: finer_feedback_settings {"name": "Tore's copy of Only mark a gap depending on the answer to a previous gap.", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"functions": {}, "ungrouped_variables": ["a", "c", "b", "discriminant", "root_2", "root_1"], "name": "Tore's copy of Only mark a gap depending on the answer to a previous gap.", "tags": ["demo"], "preamble": {"css": "", "js": ""}, "advice": "", "rulesets": {}, "parts": [{"prompt": "
Consider \\[ \\simplify[basic]{{a}x^2 + {b}x + {c}} = 0 \\]
\nWhat is the discriminant of this equation? [[0]]
\nDoes this equation have a factorisation? [[1]]
\nWhat is it?
\n[[2]] $ = 0$
\nYes
", "No
"], "displayType": "radiogroup", "maxMarks": 0, "scripts": {"mark": {"order": "instead", "script": "// apply the normal marking algorithm for this part\nthis.__proto__.mark.apply(this);\n// store whether the student said \"yes\" in an attribute that's easier to access\nthis.yes = this.ticks[0][0];"}}, "marks": 0, "showCorrectAnswer": true, "type": "1_n_2", "minMarks": 0}, {"expectedvariablenames": [], "checkingaccuracy": 0.001, "vsetrange": [0, 1], "showpreview": true, "vsetrangepoints": 5, "showCorrectAnswer": true, "answersimplification": "basic", "scripts": {}, "answer": "(x-{root_1})(x-{root_2})", "marks": 1, "checkvariablenames": false, "checkingtype": "absdiff", "type": "jme"}], "showCorrectAnswer": true, "scripts": {"mark": {"order": "instead", "script": "var gaps = this.gaps;\n// if the student said \"yes\" to gap 1, then mark their factorisation\nif(gaps[1].yes) {\n this.__proto__.mark.apply(this);\n// otherwise, work out the credit based on the amounts awarded for the first two gaps\n} else {\n this.setCredit((gaps[0].credit*gaps[0].marks+gaps[1].credit*gaps[1].marks)/(gaps[0].marks+gaps[1].marks));\n}"}, "constructor": {"order": "after", "script": "// override the default 'submit' method for the part\n// we only want to submit gap 2 if the answer to gap 1 is \"yes\"\nthis.submit = Numbas.util.extend(function() {\n this.gaps[0].submit();\n this.gaps[1].submit();\n if(this.gaps[1].yes) {\n this.gaps[2].submit();\n } else {\n this.gaps[2].answered = true;\n }\n},Part.prototype.submit);"}}, "type": "gapfill"}], "statement": "", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "type": "question", "variables": {"a": {"definition": "random(-10..10 except 0)", "templateType": "anything", "group": "Ungrouped variables", "name": "a", "description": "Coefficient of $x^2$
"}, "c": {"definition": "random(-10..10)", "templateType": "anything", "group": "Ungrouped variables", "name": "c", "description": "Constant term
"}, "b": {"definition": "random(-10..10)", "templateType": "anything", "group": "Ungrouped variables", "name": "b", "description": "Coefficient of $x$
"}, "discriminant": {"definition": "b^2-4*a*c", "templateType": "anything", "group": "Ungrouped variables", "name": "discriminant", "description": ""}, "root_2": {"definition": "(-b-sqrt(discriminant))/(2*a)", "templateType": "anything", "group": "Ungrouped variables", "name": "root_2", "description": ""}, "root_1": {"definition": "(-b+sqrt(discriminant))/(2*a)", "templateType": "anything", "group": "Ungrouped variables", "name": "root_1", "description": ""}}, "metadata": {"notes": "Look at the scripts for the gapfill part. We have to override the built-in \"submit\" method so that we only submit the final part if the answer to the multiple choice question is \"yes\".
\nThe HTML for the third part uses a Knockout binding so it's only visible when the student has answered \"yes\" to the multiple choice question (switch the rich text editor off for the prompt to see how it works).
", "description": "Student is asked whether a quadratic equation can be factorised. If they say \"yes\", they're asked to give the factorisation.
", "licence": "Creative Commons Attribution 4.0 International"}, "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}], "contributors": [{"name": "Tore Gaupseth", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/28/"}]}]}], "contributors": [{"name": "Tore Gaupseth", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/28/"}]}