Пример #1
0
 /**
  * Computes and logs the progression of a user.
  *
  * @param Evaluation $evaluation
  */
 public function handleEvaluation(Evaluation $evaluation)
 {
     $this->clearCache();
     $activity = $evaluation->getActivityParameters()->getActivity();
     $abilities = $this->abilityRepo->findByActivity($activity);
     $user = $evaluation->getUser();
     foreach ($abilities as $ability) {
         $progress = $this->getAbilityProgress($ability, $user);
         if ($evaluation->isSuccessful() && !$progress->hasPassedActivity($activity)) {
             $progress->addPassedActivity($activity);
             if ($progress->getPassedActivityCount() >= $ability->getMinActivityCount()) {
                 $progress->setStatus(AbilityProgress::STATUS_ACQUIRED);
             } else {
                 $progress->setStatus(AbilityProgress::STATUS_PENDING);
             }
             $this->computeCompetencyProgress($ability, $user);
         }
     }
     $this->om->flush();
 }
Пример #2
0
 private function updatePastEvaluation(Evaluation $evaluation)
 {
     $user = $evaluation->getUser();
     $activityParams = $evaluation->getActivityParameters();
     $log = $evaluation->getLog();
     if (!is_null($log)) {
         $pastEval = $this->pastEvaluationRepo->findPastEvaluationsByUserAndActivityParamsAndLog($user, $activityParams, $log);
         if (!is_null($pastEval)) {
             $pastEval->setScore($evaluation->getScore());
             $pastEval->setComment($evaluation->getComment());
             $this->om->persist($pastEval);
         }
     }
 }