Permalink
Browse files

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

…into MOODLE_24_STABLE
  • Loading branch information...
Sam Hemelryk
Sam Hemelryk committed Jan 6, 2013
2 parents ac41913 + 78ac855 commit 2d7c42275f190324949d7fb1b2a6ec2a7b49ce68
Showing with 8 additions and 6 deletions.
  1. +8 −6 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 2d7c422

Please sign in to comment.