mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
correct handling of correct, wrong and ignored answers in Rottmeier DropDown 2.4 quizzes
This commit is contained in:
parent
247ed91b7f
commit
b4c2849e21
1 changed files with 47 additions and 17 deletions
|
@ -1014,9 +1014,23 @@ function GetJClozeQuestionDetails(hp, v) {
|
||||||
if (r!=2.1) { // exclude Find-It 3a
|
if (r!=2.1) { // exclude Find-It 3a
|
||||||
for (var i=0, ii=0; i<I[q][1].length; i++) {
|
for (var i=0, ii=0; i<I[q][1].length; i++) {
|
||||||
var s = I[q][1][i][0];
|
var s = I[q][1][i][0];
|
||||||
if (typeof(s)=='string' && s!='' && (s.toUpperCase() != correct.toUpperCase())) {
|
if (typeof(s)=='string' && s!='') {
|
||||||
|
if (s.toUpperCase() == correct.toUpperCase()) {
|
||||||
|
var is_ignored = false;
|
||||||
|
} else {
|
||||||
|
// DropDown 2.4
|
||||||
|
var is_ignored = true;
|
||||||
|
var iii_max = HP[_wrong][q] ? HP[_wrong][q].length : 0;
|
||||||
|
for (var iii=0; iii<iii_max; iii++) {
|
||||||
|
if (s.toUpperCase() == HP[_wrong][q][iii].toUpperCase()) {
|
||||||
|
var is_ignored = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (is_ignored) {
|
||||||
x[ii++] = s;
|
x[ii++] = s;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qDetails += hpHiddenField(Q+'ignored', x);
|
qDetails += hpHiddenField(Q+'ignored', x);
|
||||||
|
@ -1526,7 +1540,18 @@ function hpClickCheck(hp, t, v, args) {
|
||||||
if (hp==5) {
|
if (hp==5) {
|
||||||
g = eval('document.Cloze.Gap'+i+'.value');
|
g = eval('document.Cloze.Gap'+i+'.value');
|
||||||
} else if (hp==6) {
|
} else if (hp==6) {
|
||||||
g = Get_SelectedDropValue(i);
|
var ii = Get_SelectedDropValue(i);
|
||||||
|
if (isNaN(ii) || ii<0) { // 'null' || -1
|
||||||
|
g = ''; // no guess yet
|
||||||
|
} else {
|
||||||
|
if (window.MakeIndividualDropdowns) {
|
||||||
|
var is_wrong = (ii!=0);
|
||||||
|
g = I[i][1][ii][0];
|
||||||
|
} else {
|
||||||
|
var is_wrong = (ii!=i);
|
||||||
|
g = I[ii][1][0][0];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (r==2.1 && i==args[0]) { // Find-It 3a
|
} else if (r==2.1 && i==args[0]) { // Find-It 3a
|
||||||
g = I[i][1][0][0];
|
g = I[i][1][0][0];
|
||||||
|
@ -1539,8 +1564,11 @@ function hpClickCheck(hp, t, v, args) {
|
||||||
// is this a new guess at this gap?
|
// is this a new guess at this gap?
|
||||||
if (ii==0 || g!=HP[_guesses][i][ii-1]) {
|
if (ii==0 || g!=HP[_guesses][i][ii-1]) {
|
||||||
HP[_guesses][i][ii] = g;
|
HP[_guesses][i][ii] = g;
|
||||||
|
if (r==1) {
|
||||||
|
// Rottmeier DropDown 2.4
|
||||||
|
// do nothing
|
||||||
|
} else {
|
||||||
var G = g.toUpperCase();
|
var G = g.toUpperCase();
|
||||||
|
|
||||||
var ii_max = I[i][1].length;
|
var ii_max = I[i][1].length;
|
||||||
for (var ii=0; ii<ii_max; ii++) {
|
for (var ii=0; ii<ii_max; ii++) {
|
||||||
if (window.CaseSensitive) {
|
if (window.CaseSensitive) {
|
||||||
|
@ -1549,8 +1577,10 @@ function hpClickCheck(hp, t, v, args) {
|
||||||
if (G==I[i][1][ii][0].toUpperCase()) break;
|
if (G==I[i][1][ii][0].toUpperCase()) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var is_wrong = (ii==ii_max);
|
||||||
if (ii==ii_max) { // guess is wrong
|
}
|
||||||
|
if (!window.gdb)window.gdb=!confirm('is_wrong=['+is_wrong+'], g=['+g+']');
|
||||||
|
if (is_wrong) { // guess is wrong
|
||||||
if (!HP[_wrong][i]) HP[_wrong][i] = new Array();
|
if (!HP[_wrong][i]) HP[_wrong][i] = new Array();
|
||||||
var ii_max = HP[_wrong][i].length;
|
var ii_max = HP[_wrong][i].length;
|
||||||
for (var ii=0; ii<ii_max; ii++) {
|
for (var ii=0; ii<ii_max; ii++) {
|
||||||
|
@ -1888,7 +1918,7 @@ function hpHiddenField(name, value, comma, forceHTML) {
|
||||||
if (comma==null) comma = ',';
|
if (comma==null) comma = ',';
|
||||||
for (var i=0; i<i_max; i++) {
|
for (var i=0; i<i_max; i++) {
|
||||||
values[i] = trim(values[i]);
|
values[i] = trim(values[i]);
|
||||||
if (values[i]!='') {
|
if (values[i]!=null && values[i]!='') {
|
||||||
value += (i==0 ? '' : comma) + encode_entities(values[i]);
|
value += (i==0 ? '' : comma) + encode_entities(values[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue