/**
  * @param Feeling      $feeling
  * @param ParamFetcher $paramFetcher
  * @return Questionnaire
  * @throws \Exception
  */
 public function updateFeeling(Feeling $feeling, ParamFetcher $paramFetcher)
 {
     $entityManager = $this->getEntityManager();
     $feeling->setEnergy($paramFetcher->get('energy'))->setFitness($paramFetcher->get('fitness'))->setStress($paramFetcher->get('stress'))->setFatigue($paramFetcher->get('fatigue'))->setMood($paramFetcher->get('mood'))->setWeight($paramFetcher->get('weight'))->setCompletedDate(new \DateTime());
     $entityManager->persist($feeling);
     $entityManager->flush();
     return $this->getParentQuestionnaireForSection($feeling);
 }
 public function testGetNormalisedArbitaryValues()
 {
     $expected = array('energy' => -1, 'fatigue' => -2, 'fitness' => 0, 'mood' => 1, 'stress' => 2, 'weight' => 0);
     $this->instance->setEnergy(21)->setFatigue(1)->setMood(61)->setStress(100);
     $this->assertEquals($expected, $this->instance->getNormalisedValues());
     $this->assertEquals(0, $this->instance->getNormalisedScore());
 }
 /**
  * @param Feeling $feeling
  * @return array
  */
 public static function extractHowAreYouFeeling(Feeling $feeling)
 {
     return array_merge($feeling->getNormalisedValues(), array('feelingSectionCompleted' => true === $feeling->isCompleted() ? "true" : "false"));
 }
Пример #4
0
 /**
  * @inheritdoc
  */
 public function isCompleted()
 {
     return $this->feelings->isCompleted() && $this->hindrances->isCompleted() && $this->dependants->isCompleted() && $this->motivations->isCompleted();
 }