Ejemplo n.º 1
0
 private function spawnActivationEvent(Area $area, $output)
 {
     if ($output instanceof CourseProgress) {
         $this->eventDispatcher->dispatch(MilestoneEvents::ACTIVATION_EVENT, new ActivationEvent($area->getProject(), $area->getEntity(), 'course.completed', function () use($output) {
             if ($output->getMandatoryCourseNum() == 0) {
                 return NewMilestoneStatus::create(100);
             } else {
                 return NewMilestoneStatus::create((int) ($output->getPassedCourseNum() / $output->getMandatoryCourseNum() * 100));
             }
         }));
     }
 }