plugin/dropzone/Controller/CorrectionController.php
private function checkUserGradeAvailable(Dropzone $dropzone, Drop $drop, $user)
    {
        // notification only in the PeerReview mode.
        $em = $this->getDoctrine()->getManager();
        $event = new LogDropGradeAvailableEvent($dropzone, $drop);
        if (1 === $dropzone->getPeerReview()) {
            // copy corrected by user

            // corrections on the user's copy
            $nbCorrectionByOthersOnUsersCopy = $em->getRepository('IcapDropzoneBundle:Correction')->getCorrectionsIds($dropzone, $drop);

            //Expected corrections
            $expectedCorrections = $dropzone->getExpectedTotalCorrection();

            /**
             * $nbCorrectionByUser = $em->getRepository('IcapDropzoneBundle:Correction')->getAlreadyCorrectedDropIds($dropzone, $user);
             * if(count($nbCorrectionByUser) >=  $expectedCorrections && count($nbCorrectionByOthersOnUsersCopy) >= $expectedCorrections  ).
             **/
            // corrected copy only instead of corrected copy AND given corrections.
            if (count($nbCorrectionByOthersOnUsersCopy) >= $expectedCorrections) {
                //dispatchEvent.
                $this->get('event_dispatcher')->dispatch('log', $event);
            }
        } else {
            $nbCorrectionByOthersOnUsersCopy = $em->getRepository('IcapDropzoneBundle:Correction')
                ->getCorrectionsIds($dropzone, $drop);

            if ($nbCorrectionByOthersOnUsersCopy > 0) {
                $this->get('event_dispatcher')->dispatch('log', $event);
            }
        }
    }
private function checkUserGradeAvailable(Dropzone $dropzone, Drop $drop, $user)
    {
        // notification only in the PeerReview mode.
        $em = $this->getDoctrine()->getManager();
        $event = new LogDropGradeAvailableEvent($dropzone, $drop);
        if (1 === $dropzone->getPeerReview()) {
            // copy corrected by user

            // corrections on the user's copy
            $nbCorrectionByOthersOnUsersCopy = $em->getRepository('IcapDropzoneBundle:Correction')->getCorrectionsIds($dropzone, $drop);

            //Expected corrections
            $expectedCorrections = $dropzone->getExpectedTotalCorrection();

            /**
             * $nbCorrectionByUser = $em->getRepository('IcapDropzoneBundle:Correction')->getAlreadyCorrectedDropIds($dropzone, $user);
             * if(count($nbCorrectionByUser) >=  $expectedCorrections && count($nbCorrectionByOthersOnUsersCopy) >= $expectedCorrections  ).
             **/
            // corrected copy only instead of corrected copy AND given corrections.
            if (count($nbCorrectionByOthersOnUsersCopy) >= $expectedCorrections) {
                //dispatchEvent.
                $this->get('event_dispatcher')->dispatch('log', $event);
            }
        } else {
            $nbCorrectionByOthersOnUsersCopy = $em->getRepository('IcapDropzoneBundle:Correction')
                ->getCorrectionsIds($dropzone, $drop);

            if ($nbCorrectionByOthersOnUsersCopy > 0) {
                $this->get('event_dispatcher')->dispatch('log', $event);
            }
        }
    }
private function checkUserGradeAvailable ( Dropzone $ dropzone , Drop $ drop , $ user ) { // notification only in the PeerReview mode. $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ event = new LogDropGradeAvailableEvent ( $ dropzone , $ drop ) ; if ( 1 === $ dropzone -> getPeerReview ( ) ) { // copy corrected by user // corrections on the user's copy $ nbCorrectionByOthersOnUsersCopy = $ em -> getRepository ( 'IcapDropzoneBundle:Correction' ) -> getCorrectionsIds ( $ dropzone , $ drop ) ; //Expected corrections $ expectedCorrections = $ dropzone -> getExpectedTotalCorrection ( ) ; /**
             * $nbCorrectionByUser = $em->getRepository('IcapDropzoneBundle:Correction')->getAlreadyCorrectedDropIds($dropzone, $user);
             * if(count($nbCorrectionByUser) >=  $expectedCorrections && count($nbCorrectionByOthersOnUsersCopy) >= $expectedCorrections  ).
             **/ // corrected copy only instead of corrected copy AND given corrections. if ( count ( $ nbCorrectionByOthersOnUsersCopy ) >= $ expectedCorrections ) { //dispatchEvent. $ this -> get ( 'event_dispatcher' ) -> dispatch ( 'log' , $ event ) ; } } else { $ nbCorrectionByOthersOnUsersCopy = $ em -> getRepository ( 'IcapDropzoneBundle:Correction' ) -> getCorrectionsIds ( $ dropzone , $ drop ) ; if ( $ nbCorrectionByOthersOnUsersCopy > 0 ) { $ this -> get ( 'event_dispatcher' ) -> dispatch ( 'log' , $ event ) ; } } }
Check the user's drop to see if he has corrected enought copy and if his copy is fully corrected
in order to notify him that his grade is available.
Check the user s drop to see if he has corrected enought copy and if his copy is fully corrected in order to notify him that his grade is available .