plugin/competency/Manager/ProgressManager.php
public function handleEvaluation(ResourceUserEvaluation $evaluation)
    {
        $this->clearCache();
        $this->om->startFlushSuite();

        $resource = $evaluation->getResourceNode();
        $abilities = $this->abilityRepo->findByResource($resource);
        $user = $evaluation->getUser();

        foreach ($abilities as $ability) {
            $this->setCompetencyProgressResourceId($ability, $user, $resource->getId());
            $progress = $this->getAbilityProgress($ability, $user);

            if ($evaluation->isSuccessful()) {
                $progress->addPassedResource($resource);

                if (AbilityProgress::STATUS_ACQUIRED !== $progress->getStatus()) {
                    if ($progress->getPassedResourceCount() >= $ability->getMinResourceCount()) {
                        $progress->setStatus(AbilityProgress::STATUS_ACQUIRED);
                        $this->om->forceFlush();
                    } else {
                        $progress->setStatus(AbilityProgress::STATUS_PENDING);
                    }
                }

                $this->computeCompetencyProgress($ability, $user);
            } else {
                $progress->addFailedResource($resource);
            }
        }

        $this->om->endFlushSuite();
    }
public function handleEvaluation(ResourceUserEvaluation $evaluation)
    {
        $this->clearCache();
        $this->om->startFlushSuite();

        $resource = $evaluation->getResourceNode();
        $abilities = $this->abilityRepo->findByResource($resource);
        $user = $evaluation->getUser();

        foreach ($abilities as $ability) {
            $this->setCompetencyProgressResourceId($ability, $user, $resource->getId());
            $progress = $this->getAbilityProgress($ability, $user);

            if ($evaluation->isSuccessful()) {
                $progress->addPassedResource($resource);

                if (AbilityProgress::STATUS_ACQUIRED !== $progress->getStatus()) {
                    if ($progress->getPassedResourceCount() >= $ability->getMinResourceCount()) {
                        $progress->setStatus(AbilityProgress::STATUS_ACQUIRED);
                        $this->om->forceFlush();
                    } else {
                        $progress->setStatus(AbilityProgress::STATUS_PENDING);
                    }
                }

                $this->computeCompetencyProgress($ability, $user);
            } else {
                $progress->addFailedResource($resource);
            }
        }

        $this->om->endFlushSuite();
    }
public function handleEvaluation ( ResourceUserEvaluation $ evaluation ) { $ this -> clearCache ( ) ; $ this -> om -> startFlushSuite ( ) ; $ resource = $ evaluation -> getResourceNode ( ) ; $ abilities = $ this -> abilityRepo -> findByResource ( $ resource ) ; $ user = $ evaluation -> getUser ( ) ; foreach ( $ abilities as $ ability ) { $ this -> setCompetencyProgressResourceId ( $ ability , $ user , $ resource -> getId ( ) ) ; $ progress = $ this -> getAbilityProgress ( $ ability , $ user ) ; if ( $ evaluation -> isSuccessful ( ) ) { $ progress -> addPassedResource ( $ resource ) ; if ( AbilityProgress :: STATUS_ACQUIRED !== $ progress -> getStatus ( ) ) { if ( $ progress -> getPassedResourceCount ( ) >= $ ability -> getMinResourceCount ( ) ) { $ progress -> setStatus ( AbilityProgress :: STATUS_ACQUIRED ) ; $ this -> om -> forceFlush ( ) ; } else { $ progress -> setStatus ( AbilityProgress :: STATUS_PENDING ) ; } } $ this -> computeCompetencyProgress ( $ ability , $ user ) ; } else { $ progress -> addFailedResource ( $ resource ) ; } } $ this -> om -> endFlushSuite ( ) ; }
Computes and logs the progression of a user.

@param ResourceUserEvaluation $evaluation
Computes and logs the progression of a user .