plugin/drop-zone/Manager/DropzoneManager.php
public function checkCompletion(Dropzone $dropzone, array $users, Drop $drop = null)
    {
        $fixedStatusList = [
            AbstractResourceEvaluation::STATUS_COMPLETED,
            AbstractResourceEvaluation::STATUS_PASSED,
            AbstractResourceEvaluation::STATUS_FAILED,
        ];
        $teamId = !empty($drop) ? $drop->getTeamUuid() : null;

        $this->om->startFlushSuite();

        /* By default drop is complete if teacher review is enabled or drop is unlocked for user */
        $isComplete = !empty($drop) ? $drop->isFinished() && (!$dropzone->isPeerReview() || $drop->isUnlockedUser()) : false;

        /* If drop is not complete by default, checks for the number of finished corrections done by user */
        if (!$isComplete) {
            $expectedCorrectionTotal = $dropzone->getExpectedCorrectionTotal();
            $finishedPeerDrops = $this->getFinishedPeerDrops($dropzone, $users[0], $teamId);
            $isComplete = count($finishedPeerDrops) >= $expectedCorrectionTotal;
        }
        if ($isComplete) {
            foreach ($users as $user) {
                $userEval = $this->resourceEvalManager->getResourceUserEvaluation($dropzone->getResourceNode(), $user, false);

                if (!empty($userEval) && !in_array($userEval->getStatus(), $fixedStatusList)) {
                    $this->resourceEvalManager->createResourceEvaluation(
                        $dropzone->getResourceNode(),
                        $user,
                        null,
                        ['status' => AbstractResourceEvaluation::STATUS_COMPLETED, 'progression' => 100]
                    );
                } elseif (!empty($drop)) {
                    $this->updateDropProgression($dropzone, $drop, 100);
                }
                //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 checkCompletion(Dropzone $dropzone, array $users, Drop $drop = null)
    {
        $fixedStatusList = [
            AbstractResourceEvaluation::STATUS_COMPLETED,
            AbstractResourceEvaluation::STATUS_PASSED,
            AbstractResourceEvaluation::STATUS_FAILED,
        ];
        $teamId = !empty($drop) ? $drop->getTeamUuid() : null;

        $this->om->startFlushSuite();

        /* By default drop is complete if teacher review is enabled or drop is unlocked for user */
        $isComplete = !empty($drop) ? $drop->isFinished() && (!$dropzone->isPeerReview() || $drop->isUnlockedUser()) : false;

        /* If drop is not complete by default, checks for the number of finished corrections done by user */
        if (!$isComplete) {
            $expectedCorrectionTotal = $dropzone->getExpectedCorrectionTotal();
            $finishedPeerDrops = $this->getFinishedPeerDrops($dropzone, $users[0], $teamId);
            $isComplete = count($finishedPeerDrops) >= $expectedCorrectionTotal;
        }
        if ($isComplete) {
            foreach ($users as $user) {
                $userEval = $this->resourceEvalManager->getResourceUserEvaluation($dropzone->getResourceNode(), $user, false);

                if (!empty($userEval) && !in_array($userEval->getStatus(), $fixedStatusList)) {
                    $this->resourceEvalManager->createResourceEvaluation(
                        $dropzone->getResourceNode(),
                        $user,
                        null,
                        ['status' => AbstractResourceEvaluation::STATUS_COMPLETED, 'progression' => 100]
                    );
                } elseif (!empty($drop)) {
                    $this->updateDropProgression($dropzone, $drop, 100);
                }
                //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 checkCompletion ( Dropzone $ dropzone , array $ users , Drop $ drop = null ) { $ fixedStatusList = [ AbstractResourceEvaluation :: STATUS_COMPLETED , AbstractResourceEvaluation :: STATUS_PASSED , AbstractResourceEvaluation :: STATUS_FAILED , ] ; $ teamId = ! empty ( $ drop ) ? $ drop -> getTeamUuid ( ) : null ; $ this -> om -> startFlushSuite ( ) ; /* By default drop is complete if teacher review is enabled or drop is unlocked for user */ $ isComplete = ! empty ( $ drop ) ? $ drop -> isFinished ( ) && ( ! $ dropzone -> isPeerReview ( ) || $ drop -> isUnlockedUser ( ) ) : false ; /* If drop is not complete by default, checks for the number of finished corrections done by user */ if ( ! $ isComplete ) { $ expectedCorrectionTotal = $ dropzone -> getExpectedCorrectionTotal ( ) ; $ finishedPeerDrops = $ this -> getFinishedPeerDrops ( $ dropzone , $ users [ 0 ] , $ teamId ) ; $ isComplete = count ( $ finishedPeerDrops ) >= $ expectedCorrectionTotal ; } if ( $ isComplete ) { foreach ( $ users as $ user ) { $ userEval = $ this -> resourceEvalManager -> getResourceUserEvaluation ( $ dropzone -> getResourceNode ( ) , $ user , false ) ; if ( ! empty ( $ userEval ) && ! in_array ( $ userEval -> getStatus ( ) , $ fixedStatusList ) ) { $ this -> resourceEvalManager -> createResourceEvaluation ( $ dropzone -> getResourceNode ( ) , $ user , null , [ 'status' => AbstractResourceEvaluation :: STATUS_COMPLETED , 'progression' => 100 ] ) ; } elseif ( ! empty ( $ drop ) ) { $ this -> updateDropProgression ( $ dropzone , $ drop , 100 ) ; } //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 Complete status for a user.

@param Dropzone $dropzone
@param array    $users
@param Drop     $drop
Computes Complete status for a user .