plugin/drop-zone/Manager/DropzoneManager.php
public function checkSuccess(Drop $drop)
    {
        $this->om->startFlushSuite();

        $dropzone = $drop->getDropzone();
        $users = [$drop->getUser()];

        if (Dropzone::DROP_TYPE_TEAM === $dropzone->getDropType()) {
            $users = $drop->getUsers();
        }
        $computeStatus = $drop->isFinished() && (!$dropzone->isPeerReview() || $drop->isUnlockedDrop());

        if (!$computeStatus) {
            $nbValidCorrections = 0;
            $expectedCorrectionTotal = $dropzone->getExpectedCorrectionTotal();
            $corrections = $drop->getCorrections();

            foreach ($corrections as $correction) {
                if ($correction->isFinished() && $correction->isValid()) {
                    ++$nbValidCorrections;
                }
            }
            $computeStatus = $nbValidCorrections >= $expectedCorrectionTotal;
        }
        if ($computeStatus) {
            $score = $drop->getScore();
            $scoreToPass = $dropzone->getScoreToPass();
            $scoreMax = $dropzone->getScoreMax();
            $status = !empty($scoreMax) && (($score / $scoreMax) * 100) >= $scoreToPass ?
                AbstractResourceEvaluation::STATUS_PASSED :
                AbstractResourceEvaluation::STATUS_FAILED;

            foreach ($users as $user) {
                $this->resourceEvalManager->createResourceEvaluation(
                    $dropzone->getResourceNode(),
                    $user,
                    null,
                    [
                        'status' => $status,
                        'score' => $score,
                        'scoreMax' => $scoreMax,
                        'data' => $this->serializeDrop($drop),
                    ],
                    ['status' => true, 'score' => true]
                );
            }

            $this->eventDispatcher->dispatch('log', new LogDropEvaluateEvent($dropzone, $drop, $drop->getScore()));

            //TODO user whose score is available must be notified by LogDropGradeAvailableEvent, when he has done his corrections AND his drop has been corrected
        }

        $this->om->endFlushSuite();
    }
public function checkSuccess(Drop $drop)
    {
        $this->om->startFlushSuite();

        $dropzone = $drop->getDropzone();
        $users = [$drop->getUser()];

        if (Dropzone::DROP_TYPE_TEAM === $dropzone->getDropType()) {
            $users = $drop->getUsers();
        }
        $computeStatus = $drop->isFinished() && (!$dropzone->isPeerReview() || $drop->isUnlockedDrop());

        if (!$computeStatus) {
            $nbValidCorrections = 0;
            $expectedCorrectionTotal = $dropzone->getExpectedCorrectionTotal();
            $corrections = $drop->getCorrections();

            foreach ($corrections as $correction) {
                if ($correction->isFinished() && $correction->isValid()) {
                    ++$nbValidCorrections;
                }
            }
            $computeStatus = $nbValidCorrections >= $expectedCorrectionTotal;
        }
        if ($computeStatus) {
            $score = $drop->getScore();
            $scoreToPass = $dropzone->getScoreToPass();
            $scoreMax = $dropzone->getScoreMax();
            $status = !empty($scoreMax) && (($score / $scoreMax) * 100) >= $scoreToPass ?
                AbstractResourceEvaluation::STATUS_PASSED :
                AbstractResourceEvaluation::STATUS_FAILED;

            foreach ($users as $user) {
                $this->resourceEvalManager->createResourceEvaluation(
                    $dropzone->getResourceNode(),
                    $user,
                    null,
                    [
                        'status' => $status,
                        'score' => $score,
                        'scoreMax' => $scoreMax,
                        'data' => $this->serializeDrop($drop),
                    ],
                    ['status' => true, 'score' => true]
                );
            }

            $this->eventDispatcher->dispatch('log', new LogDropEvaluateEvent($dropzone, $drop, $drop->getScore()));

            //TODO user whose score is available must be notified by LogDropGradeAvailableEvent, when he has done his corrections AND his drop has been corrected
        }

        $this->om->endFlushSuite();
    }
public function checkSuccess ( Drop $ drop ) { $ this -> om -> startFlushSuite ( ) ; $ dropzone = $ drop -> getDropzone ( ) ; $ users = [ $ drop -> getUser ( ) ] ; if ( Dropzone :: DROP_TYPE_TEAM === $ dropzone -> getDropType ( ) ) { $ users = $ drop -> getUsers ( ) ; } $ computeStatus = $ drop -> isFinished ( ) && ( ! $ dropzone -> isPeerReview ( ) || $ drop -> isUnlockedDrop ( ) ) ; if ( ! $ computeStatus ) { $ nbValidCorrections = 0 ; $ expectedCorrectionTotal = $ dropzone -> getExpectedCorrectionTotal ( ) ; $ corrections = $ drop -> getCorrections ( ) ; foreach ( $ corrections as $ correction ) { if ( $ correction -> isFinished ( ) && $ correction -> isValid ( ) ) { ++ $ nbValidCorrections ; } } $ computeStatus = $ nbValidCorrections >= $ expectedCorrectionTotal ; } if ( $ computeStatus ) { $ score = $ drop -> getScore ( ) ; $ scoreToPass = $ dropzone -> getScoreToPass ( ) ; $ scoreMax = $ dropzone -> getScoreMax ( ) ; $ status = ! empty ( $ scoreMax ) && ( ( $ score / $ scoreMax ) * 100 ) >= $ scoreToPass ? AbstractResourceEvaluation :: STATUS_PASSED : AbstractResourceEvaluation :: STATUS_FAILED ; foreach ( $ users as $ user ) { $ this -> resourceEvalManager -> createResourceEvaluation ( $ dropzone -> getResourceNode ( ) , $ user , null , [ 'status' => $ status , 'score' => $ score , 'scoreMax' => $ scoreMax , 'data' => $ this -> serializeDrop ( $ drop ) , ] , [ 'status' => true , 'score' => true ] ) ; } $ this -> eventDispatcher -> dispatch ( 'log' , new LogDropEvaluateEvent ( $ dropzone , $ drop , $ drop -> getScore ( ) ) ) ; //TODO user whose score is available must be notified by LogDropGradeAvailableEvent, when he has done his corrections AND his drop has been corrected } $ this -> om -> endFlushSuite ( ) ; }
Computes Success status for a Drop.

@param Drop $drop
Computes Success status for a Drop .