Skip to content

Commit

Permalink
Merge pull request #14 from jean-pasqualini/feature-training-mode
Browse files Browse the repository at this point in the history
Training mode: the solution is displayed after each question
  • Loading branch information
mickaelandrieu committed Nov 13, 2015
2 parents a5ea80e + bb0fd87 commit baa8dc6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Command/StartCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ protected function configure()
->setDescription('Starts a new question set')
->addOption('number', null, InputOption::VALUE_OPTIONAL, 'How many questions do you want?', 20)
->addOption('list', 'l', InputOption::VALUE_NONE, 'List categories')
->addOption("training", null, InputOption::VALUE_NONE, "Training mode: the solution is displayed after each question")
->addOption('show-multiple-choice', null, InputOption::VALUE_OPTIONAL, 'Should we tell you when the question is multiple choice?', true)
->addArgument('categories', InputArgument::IS_ARRAY, 'Which categories do you want (separate multiple with a space)', array())
;
Expand Down Expand Up @@ -111,6 +112,15 @@ protected function askQuestions(Set $set, InputInterface $input, OutputInterface

$set->setAnswer($i, $answers);

if($input->getOption("training"))
{
$uniqueSet = new Set(array($i => $question));

$uniqueSet->setAnswer($i, $answers);

$this->displayResults($uniqueSet, $output);
}

$output->writeln('<comment>✎ Your answer</comment>: ' . $answer . "\n");
}
}
Expand Down

0 comments on commit baa8dc6

Please sign in to comment.