Skip to content

Feature request: new grading behaviour #155

@PhilippImhof

Description

@PhilippImhof

Originally posted by @alexanderlata in #154 (comment)

For example, I ask students to solve a system of linear equations using the Gauss method. I create two parts and, with the help of JavaScript and HTML, I add a dropdown menu using the select and option tags.

Depending on the choice made in the dropdown menu, I show one part and hide the other. In the first part, I ask for an answer, and in the second part, I ask another question.
The first part is fully correct, but I want to know whether the student answered the additional question in the second part correctly (depending on their choice). As a result, I evaluate them either on the first part or the second part, ensuring that the maximum grade doesn’t exceed that of the first part.

This behavior could also be useful for other types of questions, like proofs. In the second part, I could ask to calculate an example, while in the first part, the student would fill in the gaps of the proof.

Here is my example. I have not corrected the grading logic. Please disregard it.

Moodle XML export
<?xml version="1.0" encoding="UTF-8"?>
<quiz>
<!-- question: 32764948  -->
  <question type="formulas">
    <name>
      <text>Gaussian-method-05 (uncertain system)</text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<script>
    function showFields(option) {
        var additionalFirstField = document.getElementById('additionalFirst');
        var additionalSecondField = document.getElementById('additionalSecond');
        var additionalThirdField = document.getElementById('additionalThird');
        if (option.value == "Option 1") {
            additionalFirstField.style.display = 'block';
        } else {
            additionalFirstField.style.display = 'none';
        }
        if (option.value == "Option 2") {
            additionalSecondField.style.display = 'block';
        } else {
            additionalSecondField.style.display = 'none';
        }
        if (option.value == "Option 3") {
            additionalThirdField.style.display = 'block';
        } else {
            additionalThirdField.style.display = 'none';
        }
    }
</script>


<p></p>
<p>Solve a system of linear equations using the Gaussian method</p><br>

<p dir="ltr">\[ \begin{cases} {M11} x_1&nbsp; {=d[nM12]} {M12} x_2 &nbsp;{=d[nM13]} {M13} x_3 &nbsp;{=d[nM14]} {M14} x_4 &nbsp;{=d[nM15]} {M15} x_5 ={M16} \\ {M21} x_1 &nbsp;{=d[nM22]}{M22} x_2 &nbsp;{=d[nM23]}{M23} x_3 &nbsp;{=d[nM24]}{M24} x_4 &nbsp;{=d[nM25]}{M25} x_5={M26} \\ {M31} x_1 &nbsp;{=d[nM32]} {M32} x_2 &nbsp;{=d[nM33]} {M33} x_3 &nbsp;{=d[nM34]} {M34} x_4 &nbsp;{=d[nM35]} {M35} x_5 ={M36} \end{cases} \]</p>
<p></p>This system of equations is <select onchange="showFields(this)" data-initial-value="">
    <option disabled="" value="" selected="">Select an answer option</option>
    <option value="Option 1">inconsistent</option>
    <option value="Option 2">consistent and determined</option>
    <option value="Option 3">consistent and underdetermined</option>
</select><br><br>

<div id="additionalFirst" style="display:none;">
    {#1}
</div>
<div id="additionalSecond" style="display:none;">
    {#2}
</div>
<div id="additionalThird" style="display:none;">
    {#3}
</div>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text></text>
    </generalfeedback>
    <defaultgrade>35</defaultgrade>
    <penalty>0</penalty>
    <hidden>0</hidden>
    <idnumber>question_7</idnumber>
    <correctfeedback format="html">
      <text>Ваш ответ верный.</text>
    </correctfeedback>
    <partiallycorrectfeedback format="html">
      <text>Ваш ответ частично правильный.</text>
    </partiallycorrectfeedback>
    <incorrectfeedback format="html">
      <text>Ваш ответ неправильный.</text>
    </incorrectfeedback>
<varsrandom><text>a={-9:-1};
b={-9:-1};
c={-5:-1,1:4};
d={-5:-1,1:4};
e={-9:-1};
f={0:5};
s={-5:-1,1:4};
g={-5:-1,1:4};
h={-5:-1,1:4};
i={-5:-1,1:4};
j={-5:-1,1:4};
k={-5:-1,1:4};
m={-5:-1,1:4};
n={-5:-1,1:4};
x={-5:-1,1:4};
y={-5:-1,1:4};
z={-5:-1,1:4};
u={-5:-1,1:4};
v={-5:-1,1:4};

</text>
</varsrandom>
<varsglobal><text><![CDATA[rangA = 2;
rangAb = 2;

M11 = h;
M12 = a*h;
M13 = g*h;
M14 = h*(b + e*g);
M15 = h*(c + f*g);
M16 = h*(d + g*s);
M16 = (M16>=0) ? abs(M16) : M16;

M21 = h*j;
M22 = a*h*j;
M23 = g*h*j + g*k;
M24 = e*g*k + h*j*(b + e*g);
M25 = f*g*k + h*j*(c + f*g);
M26 = g*k*s + h*j*(d + g*s);
M26 = (M26>=0) ? abs(M26) : M26;

M31 = h*m;
M32 = a*h*m;
M33 = g*h*m + g*n;
M34 = e*g*n + h*m*(b + e*g);
M35 = f*g*n + h*m*(c + f*g);
M36 = g*n*s + h*m*(d + g*s);
M36 = (M36>=0) ? abs(M36) : M36;

x1 = -a*y - b*u - c*v + d;
x2 = y;
x3 = -e*u - f*v + s;
x4 = u;
x5 = v;

d=["", "+"];

nM12 = (M12>=0) ? 1 : 0;
nM13 = (M13>=0) ? 1 : 0;
nM14 = (M14>=0) ? 1 : 0;
nM15 = (M15>=0) ? 1 : 0;

nM22 = (M22>=0) ? 1 : 0;
nM23 = (M23>=0) ? 1 : 0;
nM24 = (M24>=0) ? 1 : 0;
nM25 = (M25>=0) ? 1 : 0;

nM32 = (M32>=0) ? 1 : 0;
nM33 = (M33>=0) ? 1 : 0;
nM34 = (M34>=0) ? 1 : 0;
nM35 = (M35>=0) ? 1 : 0;
]]></text>
</varsglobal>
<answernumbering><text>abc</text>
</answernumbering>
<answers>
 <partindex>
  <text>0</text>
 </partindex>
 <placeholder>
  <text>#1</text>
 </placeholder>
 <answermark>
  <text>4</text>
 </answermark>
 <answertype>
  <text>0</text>
 </answertype>
 <numbox>
  <text>2</text>
 </numbox>
 <vars1>
  <text></text>
 </vars1>
 <answer>
  <text>[rangA, rangAb]</text>
 </answer>
 <answernotunique>
  <text>0</text>
 </answernotunique>
 <vars2>
  <text>grade_rangA = (_0 == rangA) ? 1 : 0;
grade_rangAb = (_1 == rangAb) ? 1 : 0;

grade_part1 = grade_rangA + grade_rangAb;</text>
 </vars2>
 <correctness>
  <text>grade_part1</text>
 </correctness>
 <unitpenalty>
  <text>1</text>
 </unitpenalty>
 <postunit>
  <text></text>
 </postunit>
 <ruleid>
  <text>0</text>
 </ruleid>
 <otherrule>
  <text></text>
 </otherrule>
 <subqtext format="html">
<text><![CDATA[<p dir="ltr" style="text-align: left;"><strong>Enter the solutions in the appropriate fields below</strong><br>\[\text{rank}(\mathbf{A})\\] = {_0}&nbsp;&nbsp;</p>
<p dir="ltr" style="text-align: left;">\[\text{rank}(\mathbf{\widetilde{A}})\\] = {_1}<br><br><br></p>]]></text>
 </subqtext>
 <feedback format="html">
<text></text>
 </feedback>
 <correctfeedback format="html">
<text></text>
 </correctfeedback>
 <partiallycorrectfeedback format="html">
<text></text>
 </partiallycorrectfeedback>
 <incorrectfeedback format="html">
<text></text>
 </incorrectfeedback>
</answers>
<answers>
 <partindex>
  <text>1</text>
 </partindex>
 <placeholder>
  <text>#2</text>
 </placeholder>
 <answermark>
  <text>6</text>
 </answermark>
 <answertype>
  <text>0</text>
 </answertype>
 <numbox>
  <text>5</text>
 </numbox>
 <vars1>
  <text></text>
 </vars1>
 <answer>
  <text>[x1, x2, x3,x4,x5]</text>
 </answer>
 <answernotunique>
  <text>0</text>
 </answernotunique>
 <vars2>
  <text>grade_x1 = (_0 == x1) ? 1 : 0;
grade_x2 = (_1 == x2) ? 1 : 0;
grade_x3 = (_2 == x3) ? 1 : 0;
grade_x4 = (_3 == x4) ? 1 : 0;
grade_x5 = (_4 == x5) ? 1 : 0;

grade_part2 = grade_x1 + grade_x2 + grade_x3 + grade_x4 + grade_x5;</text>
 </vars2>
 <correctness>
  <text>grade_part2</text>
 </correctness>
 <unitpenalty>
  <text>1</text>
 </unitpenalty>
 <postunit>
  <text></text>
 </postunit>
 <ruleid>
  <text>0</text>
 </ruleid>
 <otherrule>
  <text></text>
 </otherrule>
 <subqtext format="html">
<text><![CDATA[<p dir="ltr" style="text-align: left;"><strong>Enter the solutions in the appropriate fields below</strong><br>
    \[x_1\] = {_0} <br>
    \[x_2\] = {_1} <br>
    \[x_3\] = {_2} <br>\[x_4\] = {_3}<br>\[x_5\] = {_4}<br>
</p>]]></text>
 </subqtext>
 <feedback format="html">
<text></text>
 </feedback>
 <correctfeedback format="html">
<text></text>
 </correctfeedback>
 <partiallycorrectfeedback format="html">
<text></text>
 </partiallycorrectfeedback>
 <incorrectfeedback format="html">
<text></text>
 </incorrectfeedback>
</answers>
<answers>
 <partindex>
  <text>2</text>
 </partindex>
 <placeholder>
  <text>#3</text>
 </placeholder>
 <answermark>
  <text>25</text>
 </answermark>
 <answertype>
  <text>0</text>
 </answertype>
 <numbox>
  <text>5</text>
 </numbox>
 <vars1>
  <text></text>
 </vars1>
 <answer>
  <text>[x1, x2, x3, x4, x5]</text>
 </answer>
 <answernotunique>
  <text>0</text>
 </answernotunique>
 <vars2>
  <text>grade_x1 = (_0 == x1) ? 1 : 0;
grade_x2 = (_1 == x2) ? 1 : 0;
grade_x3 = (_2 == x3) ? 1 : 0;
grade_x4 = (_3 == x4) ? 1 : 0;
grade_x5 = (_4 == x5) ? 1 : 0;

grade_part3 = 5*(grade_x1 + grade_x2 + grade_x3 + grade_x4 + grade_x5);</text>
 </vars2>
 <correctness>
  <text>grade_part3</text>
 </correctness>
 <unitpenalty>
  <text>1</text>
 </unitpenalty>
 <postunit>
  <text></text>
 </postunit>
 <ruleid>
  <text>0</text>
 </ruleid>
 <otherrule>
  <text></text>
 </otherrule>
 <subqtext format="html">
<text><![CDATA[<p dir="ltr"><strong><span class="" style="color: rgb(239, 69, 64);">Find a general solution to the system of equations (write it down on a sheet of paper).</span></strong></p>
<p dir="ltr"><strong>Assign values to the free variables {y}, {u}, and {v}, in their respective orders, and find a specific solution.</strong></p>
<p dir="ltr"><strong>Enter the solutions in the appropriate fields below</strong></p>
<p dir="ltr"></p>\[x_1\] = {_0}<br>\[x_2\] = {_1}<br>\[x_3\] = {_2}<br>\[x_4\] = {_3}<br>\[x_5\] = {_4}<br>
<p></p>]]></text>
 </subqtext>
 <feedback format="html">
<text></text>
 </feedback>
 <correctfeedback format="html">
<text></text>
 </correctfeedback>
 <partiallycorrectfeedback format="html">
<text></text>
 </partiallycorrectfeedback>
 <incorrectfeedback format="html">
<text></text>
 </incorrectfeedback>
</answers>
  </question>

</quiz>

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions