Skip to content

Commit baa8dc6

Browse files
Merge pull request #14 from jean-pasqualini/feature-training-mode
Training mode: the solution is displayed after each question
2 parents a5ea80e + bb0fd87 commit baa8dc6

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

Command/StartCommand.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ protected function configure()
4545
->setDescription('Starts a new question set')
4646
->addOption('number', null, InputOption::VALUE_OPTIONAL, 'How many questions do you want?', 20)
4747
->addOption('list', 'l', InputOption::VALUE_NONE, 'List categories')
48+
->addOption("training", null, InputOption::VALUE_NONE, "Training mode: the solution is displayed after each question")
4849
->addOption('show-multiple-choice', null, InputOption::VALUE_OPTIONAL, 'Should we tell you when the question is multiple choice?', true)
4950
->addArgument('categories', InputArgument::IS_ARRAY, 'Which categories do you want (separate multiple with a space)', array())
5051
;
@@ -111,6 +112,15 @@ protected function askQuestions(Set $set, InputInterface $input, OutputInterface
111112

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

115+
if($input->getOption("training"))
116+
{
117+
$uniqueSet = new Set(array($i => $question));
118+
119+
$uniqueSet->setAnswer($i, $answers);
120+
121+
$this->displayResults($uniqueSet, $output);
122+
}
123+
114124
$output->writeln('<comment>✎ Your answer</comment>: ' . $answer . "\n");
115125
}
116126
}

0 commit comments

Comments
 (0)