Permalink
Browse files

Merge branch 'MDL-36855-m23' of git://github.com/ankitagarwal/moodle …

…into MOODLE_23_STABLE
  • Loading branch information...
2 parents c1fcc89 + 7f7e18c commit a68bc19fa6031a6a697f508baa21d4d04275f272 Sam Hemelryk committed Jan 6, 2013
Showing with 8 additions and 6 deletions.
  1. +8 −6 mod/scorm/report/reportlib.php
View
14 mod/scorm/report/reportlib.php
@@ -68,14 +68,16 @@ function get_scorm_question_count($scormid) {
$params[] = "cmi.interactions_%.id";
$rs = $DB->get_recordset_select("scorm_scoes_track", $select, $params, 'element');
$keywords = array("cmi.interactions_", ".id");
- foreach ($rs as $record) {
- $num = trim(str_ireplace($keywords, '', $record->element));
- if (is_numeric($num) && $num > $count) {
- $count = $num;
+ if ($rs->valid()) {
+ // Done as interactions start at 0 (do only if we have something to report).
+ $count++;
+ foreach ($rs as $record) {
+ $num = trim(str_ireplace($keywords, '', $record->element));
+ if (is_numeric($num) && $num > $count) {
+ $count = $num;
+ }
}
}
- //done as interactions start at 0
- $count++;
$rs->close(); // closing recordset
return $count;
}

0 comments on commit a68bc19

Please sign in to comment.