コード例 #1
0
 /**
  * @Route(
  *      "/{resourceId}/drops/detail/correction/validation/confirmation/{correctionId}/{value}",
  *      name="innova_collecticiel_revalidateCorrection",
  *      requirements ={"resourceId" ="\d+","withDropOnly"="^(withDropOnly|all|withoutDrops)$"},
  *      defaults={"page" = 1, "withDropOnly" = "all", "value"="yes" }
  * )
  * @ParamConverter("dropzone", class="InnovaCollecticielBundle:Dropzone", options={"id" = "resourceId"})
  * @ParamConverter("correction", class="InnovaCollecticielBundle:Correction", options={"id" = "correctionId"})
  * @Template()
  */
 public function RevalidateCorrectionValidationAction(Dropzone $dropzone, Correction $correction, $value)
 {
     // check if number of correction will be more than the expected.
     // only valid corrections are count
     if ($dropzone->getExpectedTotalCorrection() <= $correction->getDrop()->countFinishedCorrections()) {
         // Ask confirmation to have more correction than expected.
         $view = 'InnovaCollecticielBundle:Correction:Admin/revalidateCorrection.html.twig';
         if ($this->getRequest()->isXmlHttpRequest()) {
             $view = 'InnovaCollecticielBundle:Correction:Admin/revalidateCorrectionModal.html.twig';
         }
         return $this->render($view, array('_resource' => $dropzone, 'dropzone' => $dropzone, 'drop' => $correction->getDrop(), 'correction' => $correction));
     } else {
         $this->setCorrectionValidationAction($dropzone, $correction, 'yes', "default");
         return $this->redirect($this->generateUrl('innova_collecticiel_drops_detail', array('resourceId' => $dropzone->getId(), 'dropId' => $correction->getDrop()->getId())));
     }
 }
コード例 #2
0
 /**
  *  Test to detect the special case where the peerReview end whereas user didnt had time to make the expected
  *  number of correction.
  *
  * @param  Dropzone $dropzone
  * @param $nbCorrection
  * @return bool
  */
 public function isPeerReviewEndedOrManualStateFinished(Dropzone $dropzone, $nbCorrection)
 {
     $specialCase = false;
     if ($dropzone->getManualPlanning() && $dropzone->getManualState() == Dropzone::MANUAL_STATE_FINISHED || !$dropzone->getManualPlanning() && $dropzone->getTimeRemaining($dropzone->getEndReview()) <= 0) {
         if ($dropzone->getExpectedTotalCorrection() > $nbCorrection) {
             $specialCase = true;
         }
     }
     return $specialCase;
 }