Skip to content
Browse files

Reverted grading back to 1.4.X for when custom scoring is turned OFF

  • Loading branch information...
1 parent 4af510f commit 4e644e8d50606d85c6eb0204af9a49b05bb859a5 michaelpenne committed Oct 7, 2005
Showing with 6 additions and 19 deletions.
  1. +6 −19 mod/lesson/view.php
View
25 mod/lesson/view.php
@@ -1013,27 +1013,14 @@
if (!$lesson->custom) {
$ncorrect = 0;
$temp = array();
- if ($pagesanswered = get_records_select("lesson_attempts", "lessonid = $lesson->id AND
- userid = $USER->id AND retry = $ntries order by timeseen")) {
-
- foreach ($pagesanswered as $pageanswered) {
- if (!array_key_exists($pageanswered->pageid, $temp)) {
- $temp[$pageanswered->pageid] = array($pageanswered->correct, 1);
- } else {
- if ($temp[$pageanswered->pageid][1] < $lesson->maxattempts) {
- $n = $temp[$pageanswered->pageid][1] + 1;
- $temp[$pageanswered->pageid] = array($pageanswered->correct, $n);
- }
- }
- }
- foreach ($temp as $value => $key) {
- if ($key[0] == 1) {
- $ncorrect += 1;
- }
+ // count the number of distinct correct pages
+ if ($correctpages = get_records_select("lesson_attempts", "lessonid = $lesson->id AND
+ userid = $USER->id AND retry = $ntries AND correct = 1")) {
+ foreach ($correctpages as $correctpage) {
+ $temp[$correctpage->pageid] = 1;
}
+ $ncorrect = count($temp);
}
- $nviewed = count($temp); // this counts number of Questions the user viewed
-
echo "<p align=\"center\">".get_string("numberofpagesviewed", "lesson", $nviewed).
"</p>\n";
if ($lesson->minquestions) {

0 comments on commit 4e644e8

Please sign in to comment.
Something went wrong with that request. Please try again.