{ "source": { "author": { "name": "Merryn Horrocks" } }, "name": "List with partial marks", "short_name": "list-with-partial-marks", "description": "
The answer is a comma-separated list.
\nThe list is marked correct if each element occurs the same number of times as in the expected answer, and no extra elements are present.
\nYou get part marks if you get at least half of the required elements and no extra elements. You get part marks if you get all the elements but include extra elements. You get part marks if you get at least half and add one or more extras.
\nYou can choose whether or not the input is case-sensitive, and you can choose the proportion of marks the student gets if they give a partially correct answer.
", "help_url": "", "input_widget": "string", "input_options": { "correctAnswer": "join(\n if(settings[\"caseSensitive\"],\n settings[\"correctAnswer\"],\n map(lower(x),x,settings[\"correctAnswer\"])\n )\n ,\n \", \"\n)", "hint": { "static": true, "value": "Enter your answers (in any order) separated by commas. e.g. a,b,c" }, "allowEmpty": { "static": true, "value": false } }, "can_be_gap": true, "can_be_step": true, "marking_script": "mark:\nif(studentanswer=\"\",fail(\"You have not entered an answer\"),false);\napply(included);\napply(no_extras);\nswitch(\n all_included and no_extras, \n correct(),\n all_included and not no_extras, \n set_credit(settings[\"extraPenalty\"],\"You included all the required elements, but you also included extra elements that should not be included.\"),\n half_included and no_extras, \n set_credit(settings[\"missingPenalty\"],\"You included at least half of the required elements, but you missed some elements you needed to include.\"),\n half_included and not no_extras,\n set_credit(combined_penalty,\n \"You included at least half of the required elements, but you missed some elements you needed to include and you also included some elements that you should not have.\"),\n incorrect()\n)\n\ninterpreted_answer:\nif(settings[\"caseSensitive\"],\n bits,\n lower_bits\n )\n\nraw_bits:\nfilter(x<>\"\",x,split(studentAnswer,\",\"))\n\nbits:\nmap(trim(x),x,raw_bits)\n\nexpected_numbers:\nif(settings[\"caseSensitive\"],\n settings[\"correctAnswer\"],\n map(lower(x),x,settings[\"correctAnswer\"])\n )\n\nis_sorted:\nassert(sort(interpreted_answer)=interpreted_answer,\n multiply_credit(0.5,\"Not in order\")\n )\n\nincluded:\nmap(\n let(\n num_student,len(filter(x=y,y,interpreted_answer)),\n num_expected,len(filter(x=y,y,expected_numbers)),\n switch(\n num_student=num_expected,\n true,\n num_student