-
Bug
-
Resolution: Won't Fix
-
Minor
-
None
-
3.1.9, 3.2.6, 3.3.3, 3.4
-
MOODLE_31_STABLE, MOODLE_32_STABLE, MOODLE_33_STABLE, MOODLE_34_STABLE
I think I found an incorrect piece of code in SCORM activity see the line here:
The original code looks like this:
// code placeholder
|
if (isset($item->rolluprules)) { |
foreach ($item->rolluprules as $rolluprule) {
|
$rollup = new stdClass(); |
$rollup->scoid = $id;
|
$rollup->childactivityset = $rolluprule->childactivityset;
|
$rollup->minimumcount = $rolluprule->minimumcount;
|
$rollup->minimumpercent = $rolluprule->minimumpercent;
|
$rollup->rollupruleaction = $rolluprule->rollupruleaction;
|
$rollup->conditioncombination = $rolluprule->conditioncombination;
|
|
$rollupruleid = $DB->insert_record('scorm_seq_rolluprule', $rollup); |
if (isset($rollup->conditions)) { |
foreach ($rollup->conditions as $condition) {
|
$cond = new stdClass(); |
$cond->scoid = $rollup->scoid;
|
$cond->rollupruleid = $rollupruleid;
|
$cond->operator = $condition->operator;
|
$cond->cond = $condition->cond;
|
$conditionid = $DB->insert_record('scorm_seq_rolluprulecond', $cond); |
}
|
}
|
}
|
}
|
|
|
And the fixed one should be looking like this:
// code placeholder
|
if (isset($item->rolluprules)) { |
foreach ($item->rolluprules as $rolluprule) {
|
$rollup = new stdClass(); |
$rollup->scoid = $id;
|
$rollup->childactivityset = $rolluprule->childactivityset;
|
$rollup->minimumcount = $rolluprule->minimumcount;
|
$rollup->minimumpercent = $rolluprule->minimumpercent;
|
$rollup->rollupruleaction = $rolluprule->rollupruleaction;
|
$rollup->conditioncombination = $rolluprule->conditioncombination;
|
|
$rollupruleid = $DB->insert_record('scorm_seq_rolluprule', $rollup); |
if (isset($rolluprule->conditions)) { |
foreach ($rolluprule->conditions as $condition) {
|
$cond = new stdClass(); |
$cond->scoid = $rollup->scoid;
|
$cond->rollupruleid = $rollupruleid;
|
$cond->operator = $condition->operator;
|
$cond->cond = $condition->cond;
|
$conditionid = $DB->insert_record('scorm_seq_rolluprulecond', $cond); |
}
|
}
|
}
|
}
|
|
The code in question incorrectly checks for $rollup->conditions when it should be looking into $rolluprule->conditions.