plugin/drop-zone/Manager/DropzoneManager.php
public function getPeerDrop(Dropzone $dropzone, User $user = null, $teamId = null, $teamName = null, $withCreation = true)
    {
        $peerDrop = null;

        /* Gets user|team drop to check if it is finished before allowing peer review */
        $userDrop = $this->getFinishedUserDrop($dropzone, $user, $teamId);

        /* user|team drop is finished */
        if (!empty($userDrop)) {
            /* Gets drops where user|team has an unfinished correction */
            $unfinishedDrops = $this->getUnfinishedPeerDrops($dropzone, $user, $teamId);

            if (count($unfinishedDrops) > 0) {
                /* Returns the first drop with an unfinished correction */
                $peerDrop = $unfinishedDrops[0];
            } else {
                /* Gets drops where user|team has a finished correction */
                $finishedDrops = $this->getFinishedPeerDrops($dropzone, $user, $teamId);
                $nbCorrections = count($finishedDrops);

                /* Fetches a drop for peer correction if user|team has not made the expected number of corrections */
                if ($withCreation && $dropzone->isReviewEnabled() && $nbCorrections < $dropzone->getExpectedCorrectionTotal()) {
                    $peerDrop = $this->getAvailableDropForPeer($dropzone, $user, $teamId, $teamName);
                }
            }
        }

        return $peerDrop;
    }
public function getPeerDrop(Dropzone $dropzone, User $user = null, $teamId = null, $teamName = null, $withCreation = true)
    {
        $peerDrop = null;

        /* Gets user|team drop to check if it is finished before allowing peer review */
        $userDrop = $this->getFinishedUserDrop($dropzone, $user, $teamId);

        /* user|team drop is finished */
        if (!empty($userDrop)) {
            /* Gets drops where user|team has an unfinished correction */
            $unfinishedDrops = $this->getUnfinishedPeerDrops($dropzone, $user, $teamId);

            if (count($unfinishedDrops) > 0) {
                /* Returns the first drop with an unfinished correction */
                $peerDrop = $unfinishedDrops[0];
            } else {
                /* Gets drops where user|team has a finished correction */
                $finishedDrops = $this->getFinishedPeerDrops($dropzone, $user, $teamId);
                $nbCorrections = count($finishedDrops);

                /* Fetches a drop for peer correction if user|team has not made the expected number of corrections */
                if ($withCreation && $dropzone->isReviewEnabled() && $nbCorrections < $dropzone->getExpectedCorrectionTotal()) {
                    $peerDrop = $this->getAvailableDropForPeer($dropzone, $user, $teamId, $teamName);
                }
            }
        }

        return $peerDrop;
    }
public function getPeerDrop ( Dropzone $ dropzone , User $ user = null , $ teamId = null , $ teamName = null , $ withCreation = true ) { $ peerDrop = null ; /* Gets user|team drop to check if it is finished before allowing peer review */ $ userDrop = $ this -> getFinishedUserDrop ( $ dropzone , $ user , $ teamId ) ; /* user|team drop is finished */ if ( ! empty ( $ userDrop ) ) { /* Gets drops where user|team has an unfinished correction */ $ unfinishedDrops = $ this -> getUnfinishedPeerDrops ( $ dropzone , $ user , $ teamId ) ; if ( count ( $ unfinishedDrops ) > 0 ) { /* Returns the first drop with an unfinished correction */ $ peerDrop = $ unfinishedDrops [ 0 ] ; } else { /* Gets drops where user|team has a finished correction */ $ finishedDrops = $ this -> getFinishedPeerDrops ( $ dropzone , $ user , $ teamId ) ; $ nbCorrections = count ( $ finishedDrops ) ; /* Fetches a drop for peer correction if user|team has not made the expected number of corrections */ if ( $ withCreation && $ dropzone -> isReviewEnabled ( ) && $ nbCorrections < $ dropzone -> getExpectedCorrectionTotal ( ) ) { $ peerDrop = $ this -> getAvailableDropForPeer ( $ dropzone , $ user , $ teamId , $ teamName ) ; } } } return $ peerDrop ; }
Gets a drop for peer evaluation.

@param Dropzone $dropzone
@param User     $user
@param string   $teamId
@param string   $teamName
@param bool     $withCreation

@return Drop | null
Gets a drop for peer evaluation .