original_string: public function count_grades() {
          global $DB;
  
          if (!$this->has_instance()) {
              return 0;
          }
  
          $currentgroup = groups_get_activity_group($this->get_course_module(), true);
          list($esql, $params) = get_enrolled_sql($this->get_context(), 'mod/assign:submit', $currentgroup, true);
  
          $params['assignid'] = $this->get_instance()->id;
  
          $sql = 'SELECT COUNT(g.userid)
                     FROM {assign_grades} g
                     JOIN(' . $esql . ') e ON e.id = g.userid
                     WHERE g.assignment = :assignid';
  
          return $DB->count_records_sql($sql, $params);
      }
code: public function count_grades() {
          global $DB;
  
          if (!$this->has_instance()) {
              return 0;
          }
  
          $currentgroup = groups_get_activity_group($this->get_course_module(), true);
          list($esql, $params) = get_enrolled_sql($this->get_context(), 'mod/assign:submit', $currentgroup, true);
  
          $params['assignid'] = $this->get_instance()->id;
  
          $sql = 'SELECT COUNT(g.userid)
                     FROM {assign_grades} g
                     JOIN(' . $esql . ') e ON e.id = g.userid
                     WHERE g.assignment = :assignid';
  
          return $DB->count_records_sql($sql, $params);
      }
code_tokens: public function count_grades ( ) { global $ DB ; if ( ! $ this -> has_instance ( ) ) { return 0 ; } $ currentgroup = groups_get_activity_group ( $ this -> get_course_module ( ) , true ) ; list ( $ esql , $ params ) = get_enrolled_sql ( $ this -> get_context ( ) , 'mod/assign:submit' , $ currentgroup , true ) ; $ params [ 'assignid' ] = $ this -> get_instance ( ) -> id ; $ sql = 'SELECT COUNT(g.userid)
                     FROM {assign_grades} g
                     JOIN(' . $ esql . ') e ON e.id = g.userid
                     WHERE g.assignment = :assignid' ; return $ DB -> count_records_sql ( $ sql , $ params ) ; }
docstring: Load a count of grades.
  
  @return int number of grades
docstring_tokens: Load a count of grades .