Activity completion MDL-24746 Altering grade in assignment, clearing override in...
authorSam Marshall <s.marshall@open.ac.uk>
Mon, 18 Oct 2010 17:02:58 +0000 (17:02 +0000)
committerSam Marshall <s.marshall@open.ac.uk>
Mon, 18 Oct 2010 17:02:58 +0000 (17:02 +0000)
lib/completionlib.php

index d1d8141..f0482db 100644 (file)
@@ -1232,7 +1232,7 @@ class completion_info {
         } else {
             $possibleresult = $this->internal_get_grade_state($item, $grade);
         }
-
+        
         // OK, let's update state based on this
         $this->update_state($cm, $possibleresult, $grade->userid);
     }
@@ -1270,8 +1270,14 @@ class completion_info {
                 return COMPLETION_COMPLETE_FAIL;
             }
         } else {
-            // Not displaying pass/fail, but we know grade exists b/c we got here
-            return COMPLETION_COMPLETE;
+            // Not displaying pass/fail, so just if there is a grade
+            if (!is_null($grade->finalgrade) || !is_null($grade->rawgrade)) {
+                // Grade exists, so maybe complete now
+                return COMPLETION_COMPLETE;
+            } else {
+                // Grade does not exist, so maybe incomplete now
+                return COMPLETION_INCOMPLETE;
+            }
         }
     }