mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Merge branch 'MDL-35023' of git://github.com/timhunt/moodle
This commit is contained in:
commit
05a024d393
1 changed files with 8 additions and 6 deletions
|
@ -1701,17 +1701,19 @@ class qtype_calculated extends question_type {
|
||||||
WHERE i.id = d.datasetdefinition AND i.category = ?";
|
WHERE i.id = d.datasetdefinition AND i.category = ?";
|
||||||
if ($records = $DB->get_records_sql($sql, array($category))) {
|
if ($records = $DB->get_records_sql($sql, array($category))) {
|
||||||
foreach ($records as $r) {
|
foreach ($records as $r) {
|
||||||
|
$key = "$r->type-$r->category-$r->name";
|
||||||
$sql1 = "SELECT q.*
|
$sql1 = "SELECT q.*
|
||||||
FROM {question} q
|
FROM {question} q
|
||||||
WHERE q.id = ?";
|
WHERE q.id = ?";
|
||||||
if (!isset ($datasetdefs["$r->type-$r->category-$r->name"])) {
|
if (!isset($datasetdefs[$key])) {
|
||||||
$datasetdefs["$r->type-$r->category-$r->name"]= $r;
|
$datasetdefs[$key] = $r;
|
||||||
}
|
}
|
||||||
if ($questionb = $DB->get_records_sql($sql1, array($r->question))) {
|
if ($questionb = $DB->get_records_sql($sql1, array($r->question))) {
|
||||||
$datasetdefs["$r->type-$r->category-$r->name"]->questions[
|
$datasetdefs[$key]->questions[$r->question] = new stdClass();
|
||||||
$r->question]->name = $questionb[$r->question]->name;
|
$datasetdefs[$key]->questions[$r->question]->name =
|
||||||
$datasetdefs["$r->type-$r->category-$r->name"]->questions[
|
$questionb[$r->question]->name;
|
||||||
$r->question]->id = $questionb[$r->question]->id;
|
$datasetdefs[$key]->questions[$r->question]->id =
|
||||||
|
$questionb[$r->question]->id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue