Returns true if there are already people who has been graded on this definition.
In this case plugins may restrict changes of the grading definition

@return boolean
193766
public function has_active_instances() {
        global $DB;
        if (empty($this->definition->id)) {
            return false;
        }
        if ($this->hasactiveinstances === null) {
            $conditions = array('definitionid'  => $this->definition->id,
                        'status'  => gradingform_instance::INSTANCE_STATUS_ACTIVE);
            $this->hasactiveinstances = $DB->record_exists('grading_instances', $conditions);
        }
        return $this->hasactiveinstances;
    }
656700
def __normalize(self):
        

        # Don't normalize if we're already normalizing or intializing
        if self.__normalizing is True or self.__initialized is False:
            return

        self.__normalizing = True
        self.__normalize_grades()
        self.__normalize_progress()
        self.__normalizing = False
470761
public function has_overrides() {
        global $DB;

        $override = $DB->record_exists('assign_overrides', array('assignid' => $this->get_instance()->id));

        if ($override) {
            return true;
        }

        return false;
    }
491111
protected function is_graded($userid) {
        $grade = $this->get_user_grade($userid, false);
        if ($grade) {
            return ($grade->grade !== null && $grade->grade >= 0);
        }
        return false;
    }
776616
public function IsValidForCurrentUser()
    {
        $bIsValidForUser = false;
        $bIsValidShippingCountry = false;
        $bIsValidBillingCountry = false;

        $oUser = TdbDataExtranetUser::GetInstance();
        $bIsValidGroup = $this->checkUserGroup($oUser);
        if ($bIsValidGroup) {
            $bIsValidForUser = $this->checkUser($oUser);
        }
        if ($bIsValidForUser && $bIsValidGroup) {
            $bIsValidShippingCountry = $this->checkUserShippingCountry($oUser);
        }
        if ($bIsValidForUser && $bIsValidGroup && $bIsValidShippingCountry) {
            $bIsValidBillingCountry = $this->checkUserBillingCountry($oUser);
        }

        return $bIsValidForUser && $bIsValidGroup && $bIsValidShippingCountry && $bIsValidBillingCountry;
    }
1068133
public function isRegular()
    {
        // an empty graph is considered regular
        if ($this->graph->getVertices()->isEmpty()) {
            return true;
        }
        try {
            $this->getDegree();

            return true;
        } catch (UnexpectedValueException $ignore) { }

        return false;
    }
649023
public function hasVisibleSubCats()
    {
        if ($this->_blHasVisibleSubCats === null) {
            $this->_blHasVisibleSubCats = false;
            if ($activeCategory = $this->getActiveCategory()) {
                $this->_blHasVisibleSubCats = $activeCategory->getHasVisibleSubCats();
            }
        }

        return $this->_blHasVisibleSubCats;
    }
158143
public function is_calculated() {
        if (empty($this->calculation)) {
            return false;
        }

        /*
         * The main reason why we use the ##gixxx## instead of [[idnumber]] is speed of depends_on(),
         * we would have to fetch all course grade items to find out the ids.
         * Also if user changes the idnumber the formula does not need to be updated.
         */

        // first detect if we need to change calculation formula from [[idnumber]] to ##giXXX## (after backup, etc.)
        if (!$this->calculation_normalized and strpos($this->calculation, '[[') !== false) {
            $this->set_calculation($this->calculation);
        }

        return !empty($this->calculation);
    }
224746
public function canEdit(): bool
    {
        if ($this->isPendingDeletion()) {
            return false;
        }

        if (Auth::isManager($this->record->tree())) {
            return true;
        }

        // Members cannot edit RESN, CHAN and locked records
        return Auth::isEditor($this->record->tree()) && strpos($this->gedcom, "\n2 RESN locked") === false && $this->getTag() !== 'RESN' && $this->getTag() !== 'CHAN';
    }
421801
private function hasToBeReloaded()
    {
        if (!$this->getWurflConfig()->allowReload) {
            return false;
        }

        $state = $this->getPersistenceStorage()->load(self::WURFL_API_STATE);

        return !$this->isStateCurrent($state);
    }
992568
public function is_gradebook_feedback_enabled() {
        // Get default grade book feedback plugin.
        $adminconfig = $this->get_admin_config();
        $gradebookplugin = $adminconfig->feedback_plugin_for_gradebook;
        $gradebookplugin = str_replace('assignfeedback_', '', $gradebookplugin);

        // Check if default gradebook feedback is visible and enabled.
        $gradebookfeedbackplugin = $this->get_feedback_plugin_by_type($gradebookplugin);

        if (empty($gradebookfeedbackplugin)) {
            return false;
        }

        if ($gradebookfeedbackplugin->is_visible() && $gradebookfeedbackplugin->is_enabled()) {
            return true;
        }

        // Gradebook feedback plugin is either not visible/enabled.
        return false;
    }
496880
public function mark_for_regrade() {
        global $DB;
        if ($this->has_active_instances()) {
            $conditions = array('definitionid'  => $this->definition->id,
                        'status'  => gradingform_instance::INSTANCE_STATUS_ACTIVE);
            $DB->set_field('grading_instances', 'status', gradingform_instance::INSTANCE_STATUS_NEEDUPDATE, $conditions);
        }
    }
100560
public function previous_level()
    {
        if (!$this->previous_level) {
            $this->previous_level = new Level(
                $this->level->profile,
                $this->level->number - 1
            );
        }
        return $this->previous_level;
    }
102491
public static function isIgnoringCase() 
    {
        $cls = get_called_class();
        if (!array_key_exists($cls, self::$_ignorecase)) {
            return true;
        }
        return self::$_ignorecase[$cls];
    }
641749
public function isQualified() {
    $absolute = $this->isAbsolute();
    $parts = $this->getParts();
    return !$absolute && count($parts) > 1;
  }
331378
public function valid()
    {

        $allowedValues = $this->getGradeAllowableValues();
        if (!in_array($this->container['grade'], $allowedValues)) {
            return false;
        }
        $allowedValues = $this->getSubjectAllowableValues();
        if (!in_array($this->container['subject'], $allowedValues)) {
            return false;
        }
        return true;
    }
1077129
public function earnedPlatinum() : bool
    {
        if (
            $this->trophyInfo() === null || 
            !isset($this->trophyInfo()->definedTrophies->platinum) || 
            !$this->trophyInfo()->definedTrophies->platinum
        ) {
            return false;
        }

        $user = $this->hasPlayed();

        return ($user === false) ? false : boolval($user->earnedTrophies->platinum);
    }