Questtype ?textinput?: small simplifications
This commit is contained in:
parent
8d903135a5
commit
8f6fdb3fa2
3 changed files with 18 additions and 17 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue