add some checks to not throw IdNotFound exception for empty Quests (fixes #9)

This commit is contained in:
oliver 2015-04-09 15:52:11 +02:00
commit df7c22c8fc
7 changed files with 68 additions and 52 deletions

View file

@ -134,12 +134,16 @@
$correctAnswersCount += $this->isMatching($field['regex'], $field['answer']);
}
}
// Show count
$showcount = (count($this->request->getGetParams()) > 1);
// Pass data to view
$this->set('task', $task);
$this->set('fields', $fields);
$this->set('count', $correctAnswersCount);
$this->set('showcount', $showcount);
}

View file

@ -9,6 +9,8 @@
<?php endforeach ?>
<?=$t->t(mb_substr($task['text'], $posStart, mb_strlen($task['text'], 'UTF-8')-$posStart, 'UTF-8'))?>
</p>
<?php if($showcount) : ?>
<p><?=sprintf(_('You filled %d of %d fields correctly'), $count, count($fields))?>.</p>
<?php endif ?>
<input type="submit" name="submit" value="<?=_('solve')?>" />
</form>