Fix issue for speed calculation in READING_SPEED question type and finetune display - refs #1896

pull/2487/head
Yannick Warnier 9 years ago
parent 34cef4c3b7
commit 5ffb16cbf9
  1. 17
      main/exercise/ReadingSpeed.php
  2. 2
      main/template/default/exercise/reading_speed.tpl

@ -44,7 +44,7 @@ class ReadingSpeed extends UniqueAnswer
* Refresh delay in seconds
* @var int
*/
public $refreshTime = 5;
public $refreshTime = 3;
/**
* Constructor
@ -54,10 +54,6 @@ class ReadingSpeed extends UniqueAnswer
parent::__construct();
$this->type = READING_SPEED;
$this->isContent = $this->getIsContent();
// Refresh is set to 5s, but speed is in words per minute
$wordsPerSecond = $this->speeds[$this->level] / 60;
$this->expectedWordsPerRefresh = intval($wordsPerSecond * $this->refreshTime);
}
public function createAnswersForm($form)
@ -145,9 +141,16 @@ class ReadingSpeed extends UniqueAnswer
public function processText($text)
{
//recalulate the expected words count
$this->expectedCount = $this->speeds[$this->level];
// Refresh is set to 5s, but speed is in words per minute
error_log($this->getLevel().' '.$this->speeds[$this->level]);
$wordsPerSecond = $this->speeds[$this->level] / 60;
$this->expectedWordsPerRefresh = intval($wordsPerSecond * $this->refreshTime);
if (empty($text)) {
// We have an issue here... how do we treat this case?
// For now, let's define a default case
$text = get_lang('NoExercise');
}
$words = str_word_count($text, 2, '0..9');
$indexes = array_keys($words);

@ -13,7 +13,7 @@
color: rgba(0, 0, 0, 1);
}
.text-highlight.border {
color: #888;
color: #bbb;
}
</style>

Loading…
Cancel
Save