/** * @param \Icap\DropzoneBundle\Entity\Dropzone $dropzone * @param \Icap\DropzoneBundle\Entity\Drop $drop */ public function __construct(Dropzone $dropzone, Drop $drop) { $this->dropzone = $dropzone; $this->drop = $drop; $this->details = array('drop' => $drop, 'dropGrade' => $drop->getCalculatedGrade(), 'resultMax' => 20, 'dropzoneId' => $dropzone->getId(), 'dropId' => $drop->getId()); parent::__construct($dropzone->getResourceNode(), $this->details); }
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('IcapDropzoneBundle: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); } } } }
public function testgetCalculatedGrade() { echo "testing DROP->getCalculatedGrade\n"; $correction1 = $this->createCorrection(10); $correction2 = $this->createCorrection(20); $correction3 = $this->createCorrection(5); $correction4 = $this->createCorrection(3, false); $correction5 = $this->createCorrection(12, false, false); $drop1 = new Drop(); $drop1->setCorrections(array($correction1, $correction2)); $this->assertEquals(15, $drop1->getCalculatedGrade()); $drop2 = new Drop(); $drop2->setCorrections(array($correction2, $correction3, $correction4, $correction5)); $this->assertEquals(12.5, $drop2->getCalculatedGrade()); $drop3 = new Drop(); $drop3->setCorrections(array($correction4, $correction5)); $this->assertEquals(-1, $drop3->getCalculatedGrade()); }
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('IcapDropzoneBundle: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); } } } }