Esempio n. 1
0
 /**
  * Get score for a question with key word.
  *
  *
  * @param \UJM\ExoBundle\Entity\WordResponse $wr
  * @param string $response
  *
  * @return float
  */
 protected function getScoreWordResponse($wr, $response)
 {
     $score = 0;
     $formattedResponse = trim($response);
     $formattedWord = trim($wr->getResponse());
     if (!$wr->getCaseSensitive()) {
         $formattedResponse = strtolower($formattedResponse);
         $formattedWord = strtolower($formattedWord);
     }
     if ($formattedResponse === $formattedWord) {
         $score = $wr->getScore();
     }
     return $score;
 }
Esempio n. 2
0
 /**
  * Get score for a question with key word
  *
  * @access private
  *
  * @param \UJM\ExoBundle\Entity\WordResponse $wr
  * @param String $response
  *
  * @return float
  */
 private function getScoreWordResponse($wr, $response)
 {
     $score = 0;
     if (strcasecmp(trim($wr->getResponse()), trim($response)) == 0 && $wr->getCaseSensitive() == false || trim($wr->getResponse()) == trim($response)) {
         $score = $wr->getScore();
     }
     return $score;
 }