original_string: public function inform_grade_changed($cm, $item, $grade, $deleted) {
          // Bail out now if completion is not enabled for course-module, it is enabled
          // but is set to manual, grade is not used to compute completion, or this
          // is a different numbered grade
          if (!$this->is_enabled($cm) ||
              $cm->completion == COMPLETION_TRACKING_MANUAL ||
              is_null($cm->completiongradeitemnumber) ||
              $item->itemnumber != $cm->completiongradeitemnumber) {
              return;
          }
  
          // What is the expected result based on this grade?
          if ($deleted) {
              // Grade being deleted, so only change could be to make it incomplete
              $possibleresult = COMPLETION_INCOMPLETE;
          } else {
              $possibleresult = self::internal_get_grade_state($item, $grade);
          }
  
          // OK, let's update state based on this
          $this->update_state($cm, $possibleresult, $grade->userid);
      }
code: public function inform_grade_changed($cm, $item, $grade, $deleted) {
          // Bail out now if completion is not enabled for course-module, it is enabled
          // but is set to manual, grade is not used to compute completion, or this
          // is a different numbered grade
          if (!$this->is_enabled($cm) ||
              $cm->completion == COMPLETION_TRACKING_MANUAL ||
              is_null($cm->completiongradeitemnumber) ||
              $item->itemnumber != $cm->completiongradeitemnumber) {
              return;
          }
  
          // What is the expected result based on this grade?
          if ($deleted) {
              // Grade being deleted, so only change could be to make it incomplete
              $possibleresult = COMPLETION_INCOMPLETE;
          } else {
              $possibleresult = self::internal_get_grade_state($item, $grade);
          }
  
          // OK, let's update state based on this
          $this->update_state($cm, $possibleresult, $grade->userid);
      }
code_tokens: public function inform_grade_changed ( $ cm , $ item , $ grade , $ deleted ) { // Bail out now if completion is not enabled for course-module, it is enabled // but is set to manual, grade is not used to compute completion, or this // is a different numbered grade if ( ! $ this -> is_enabled ( $ cm ) || $ cm -> completion == COMPLETION_TRACKING_MANUAL || is_null ( $ cm -> completiongradeitemnumber ) || $ item -> itemnumber != $ cm -> completiongradeitemnumber ) { return ; } // What is the expected result based on this grade? if ( $ deleted ) { // Grade being deleted, so only change could be to make it incomplete $ possibleresult = COMPLETION_INCOMPLETE ; } else { $ possibleresult = self :: internal_get_grade_state ( $ item , $ grade ) ; } // OK, let's update state based on this $ this -> update_state ( $ cm , $ possibleresult , $ grade -> userid ) ; }
docstring: Called by grade code to inform the completion system when a grade has
  been changed. If the changed grade is used to determine completion for
  the course-module, then the completion status will be updated.
  
  @param stdClass|cm_info $cm Course-module for item that owns grade
  @param grade_item $item Grade item
  @param stdClass $grade
  @param bool $deleted
docstring_tokens: Called by grade code to inform the completion system when a grade has been changed . If the changed grade is used to determine completion for the course - module then the completion status will be updated .