private function sendFinishedLog(Drop $drop) { // var_dump('sendFinishedLog'); if ($drop != null) { // var_dump('drop not null'); if ($drop->getDropzone()->getPeerReview() === false or $drop->countFinishedCorrections() >= $drop->getDropzone()->getExpectedTotalCorrection()) { // var_dump('pas de peer review ou bien assez de correction'); $finished = false; if ($drop->getDropzone()->getPeerReview() === true) { // var_dump('peer review. mais est ce que le user a corrigé assez de copie'); $nbCorrections = $this->entityManager->getRepository('InnovaCollecticielBundle:Correction')->countFinished($drop->getDropzone(), $drop->getUser()); if ($nbCorrections >= $drop->getDropzone()->getExpectedTotalCorrection()) { $finished = true; } } else { // var_dump('pas de peer review donc fini !'); $finished = true; } if ($finished === true) { // var_dump('finish'); $grade = $drop->getCalculatedGrade(); $event = new LogDropEvaluateEvent($drop->getDropzone(), $drop, $grade); $event->setDoer($drop->getUser()); // var_dump('finish grade = '.$grade); $this->eventDispatcher->dispatch('log', $event); } } } }
private function sendFinishedLog(Drop $drop) { if ($drop != null) { if ($drop->getDropzone()->getPeerReview() === false || $drop->countFinishedCorrections() >= $drop->getDropzone()->getExpectedTotalCorrection()) { $finished = false; if ($drop->getDropzone()->getPeerReview() === true) { $nbCorrections = $this->entityManager->getRepository('InnovaCollecticielBundle:Correction')->countFinished($drop->getDropzone(), $drop->getUser()); if ($nbCorrections >= $drop->getDropzone()->getExpectedTotalCorrection()) { $finished = true; } } else { $finished = true; } if ($finished === true) { $grade = $drop->getCalculatedGrade(); $event = new LogDropEvaluateEvent($drop->getDropzone(), $drop, $grade); $event->setDoer($drop->getUser()); $this->eventDispatcher->dispatch('log', $event); } } } }
/** * @param Drop $drop * @param User $user * * @return \Symfony\Component\HttpFoundation\RedirectResponse * @Route( * "/unlock/drop/{dropId}", * name="innova_collecticiel_unlock_drop", * requirements={"resourceId" = "\d+", "dropId" = "\d+"} * ) * @ParamConverter("drop", class="InnovaCollecticielBundle:Drop", options={"id" = "dropId"}) * @ParamConverter("user", options={ * "authenticatedUser" = true, * "messageEnabled" = true, * "messageTranslationKey" = "This action requires authentication. Please login.", * "messageTranslationDomain" = "innova_collecticiel" * }) * @Template() */ public function unlockDropAction(Drop $drop, User $user) { $em = $this->getDoctrine()->getManager(); $drop->setUnlockedDrop(true); $em->flush(); $this->getRequest()->getSession()->getFlashBag()->add('success', $this->get('translator')->trans('Drop have been unlocked', [], 'innova_collecticiel')); $dropzoneId = $drop->getDropzone()->getId(); return $this->redirect($this->generateUrl('innova_collecticiel_drops_awaiting', ['resourceId' => $dropzoneId])); }
private function checkUserGradeAvailableByDrop(Drop $drop) { $user = $drop->getUser(); $dropzone = $drop->getDropzone(); $this->checkUserGradeAvailable($dropzone, $drop, $user); }
/** * Handle CommentText for Documents. * * @param Drop $drop drop * * @return notationCommentTextDocuments */ public function getChoiceTextForDocuments(Drop $drop) { $notationChoiceTextDocuments = array(); $dropzone = $drop->getDropzone(); foreach ($drop->getDocuments() as $document) { $documentId = $document->getId(); // Ajout pour avoir la notation. $notations = $this->em->getRepository('InnovaCollecticielBundle:Notation')->findBy(array('document' => $documentId, 'dropzone' => $dropzone->getId())); // Nombre de notation pour le document et pour le dropzone $countExistNotation = count($notations); if ($countExistNotation == 0) { $notationCommentTextDocuments[$documentId] = ''; } else { // Parcours des commentaires des documents sélectionnés foreach ($notations as $notation) { if (strlen($notation->getCommentText()) == 0) { $notationCommentTextDocuments[$documentId] = ''; } else { $notationCommentTextDocuments[$documentId] = $notation->getCommentText(); } } } } return $notationChoiceTextDocuments; }