From 9610d99636ae94f9ab922908c8561b0217741e05 Mon Sep 17 00:00:00 2001 From: Giovanne Oliveira Date: Fri, 27 May 2022 17:49:36 +0000 Subject: [PATCH 1/3] added candidate name prompt when user doesn't supply it via argument --- app/Commands/CreateInterviewCommand.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Commands/CreateInterviewCommand.php b/app/Commands/CreateInterviewCommand.php index 61c7a75..7e8d284 100644 --- a/app/Commands/CreateInterviewCommand.php +++ b/app/Commands/CreateInterviewCommand.php @@ -60,6 +60,10 @@ public function handle() $candidateName = $this->argument('name'); $candidateName = str_replace(' ', '_', $candidateName); + if(!$candidateName || empty($candidateName)){ + $candidateName = $this->ask('Please enter the candidate name'); + } + $this->info('Creating interview environment for ' . $candidateName); $this->candidateName = $candidateName; From 2a1d071e776ae4f361ea10ccd555ee71eef7b959 Mon Sep 17 00:00:00 2001 From: Giovanne Oliveira Date: Fri, 27 May 2022 17:58:22 +0000 Subject: [PATCH 2/3] changed completionSteps prompt to menu type --- app/Commands/CloseInterviewCommand.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/Commands/CloseInterviewCommand.php b/app/Commands/CloseInterviewCommand.php index 08d38e9..dcc43b5 100644 --- a/app/Commands/CloseInterviewCommand.php +++ b/app/Commands/CloseInterviewCommand.php @@ -98,13 +98,17 @@ public function handle() $this->backupCandidateFiles = $this->confirm('Do you want to backup the candidate files and database?', true); $this->removeCandidateData = $this->confirm('Do you want to delete the candidate files and database?', true); - $this->completionSteps = $this->question('How many steps the candidate completed before the end of the test?', 0); + $this->completionSteps = $this->menu('How many steps the candidate completed before the end of the test?', [ + '1 step', + '2 steps', + '3 steps', + '4 steps', + '5 steps', + ])->disableDefaultItems()->open(); - $this->hireRecommendation = $this->choice('What\'s your recommendation for this candidate?', ['strong no hire', 'not recommended', 'recommended', 'strong hire']); + $this->hireRecomendation = $this->menu('What\'s your recommendation for this candidate?', ['strong no hire', 'not recommended', 'recommended', 'strong hire'], 'strong hire')->disableDefaultItems()->open(); - if($this->hireRecommendation > 1){ - $this->indicatedPosition = $this->choice('What\'s the indicated position for this candidate?', ['junior', 'mid', 'senior', 'lead', 'other']); - } + $this->indicatedPosition = $this->menu('What\'s the indicated position for this candidate?', ['junior', 'mid', 'senior', 'lead', 'other'], 'other')->disableDefaultItems()->open(); $this->info('Closing interview environment for ' . $this->candidateName); @@ -341,7 +345,7 @@ private function postActionHooks() $score = 0; DB::update( 'UPDATE code_server_instances SET hire_recommendation_level = ?, position_level_recommendation = ?, general_score = ? WHERE id = ?', - [$this->hireRecommendation, $this->indicatedPosition, $score, $this->interviewId] + [$this->hireRecommendation, $this->indicatedPosition, $score, $this->interviewId] ); From e0fcd8927140aa0734287434ff85c7611ed58dbd Mon Sep 17 00:00:00 2001 From: Giovanne Oliveira Date: Fri, 27 May 2022 18:09:03 +0000 Subject: [PATCH 3/3] make candidate name optional --- app/Commands/CloseInterviewCommand.php | 7 ++++++- app/Commands/CreateInterviewCommand.php | 7 +++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/Commands/CloseInterviewCommand.php b/app/Commands/CloseInterviewCommand.php index dcc43b5..4edb345 100644 --- a/app/Commands/CloseInterviewCommand.php +++ b/app/Commands/CloseInterviewCommand.php @@ -21,7 +21,7 @@ class CloseInterviewCommand extends Command * * @var string */ - protected $signature = 'close {name : The candidate name (required)}'; + protected $signature = 'close {name? : The candidate name (required)}'; /** * The description of the command. @@ -59,6 +59,11 @@ public function handle() // Run the app $this->line($this->getApplication()->getName()); + + if(!$this->argument('name') || empty($this->argument('name'))){ + $candidateName = $this->ask('Please enter the candidate name'); + } + $this->candidateName = str_replace(' ', '_', $this->argument('name')); if ($this->task('Running pre-checks...', function () { diff --git a/app/Commands/CreateInterviewCommand.php b/app/Commands/CreateInterviewCommand.php index 7e8d284..28db694 100644 --- a/app/Commands/CreateInterviewCommand.php +++ b/app/Commands/CreateInterviewCommand.php @@ -19,7 +19,7 @@ class CreateInterviewCommand extends Command * * @var string */ - protected $signature = 'init {name : The candidate name (required)}'; + protected $signature = 'init {name? : The candidate name (required)}'; /** * The description of the command. @@ -59,10 +59,13 @@ public function handle() $this->line($this->getApplication()->getName()); $candidateName = $this->argument('name'); - $candidateName = str_replace(' ', '_', $candidateName); + if(!$candidateName || empty($candidateName)){ $candidateName = $this->ask('Please enter the candidate name'); } + + $candidateName = str_replace(' ', '_', $candidateName); + $this->info('Creating interview environment for ' . $candidateName); $this->candidateName = $candidateName;