Questtype ?textinput?: small simplifications

This commit is contained in:
coderkun 2014-05-19 12:04:44 +02:00
commit 8f6fdb3fa2
3 changed files with 18 additions and 17 deletions

View file

@ -76,26 +76,20 @@
$fields = $this->Textinput->getTextinputFields($quest['id']);
// Match regexs with user answers
$allSolved = true;
foreach($fields as &$field)
{
$pos = intval($field['number']) - 1;
if(!array_key_exists($pos, $answers))
{
$allSolved = false;
break;
if(!array_key_exists($pos, $answers)) {
return false;
}
if(!$this->isMatching($field['regex'], $answers[$pos]))
{
$allSolved = false;
break;
if(!$this->isMatching($field['regex'], $answers[$pos])) {
return false;
}
}
// Set status
return $allSolved;
// All answers right
return true;
}