Skip to content

Commit

Permalink
Merge pull request #13 from surgeforward/AdjustTheWayJiraAsksForTasks
Browse files Browse the repository at this point in the history
Adjust the way jira asks for tasks
  • Loading branch information
jeremysawesome authored Jun 14, 2016
2 parents f93fd2a + f0fd60a commit 82c0dce
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/Nagger.Services/JIRA/JiraRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public Task AskForTask()
var projects = _projectService.GetProjects().ToList();
_outputService.ShowInformation(OutputProjects(projects));
var projectKey = _inputService.AskForInput("Which project Key are you working on?");
_outputService.LoadingMessage("Getting tasks for that project. This might take a while.");
_outputService.LoadingMessage("Getting tasks for that project. This might take a while. (especially for large projects)");
var project = _projectService.GetProjectByKey(projectKey);
var tasks = _taskService.GetTasksByProject(project);
_outputService.ShowInformation("Ok. We've got the tasks. Outputting the tasks for that project.");
Expand All @@ -65,11 +65,19 @@ static string OutputProjects(ICollection<Project> projects)

Task AskForSpecificTask()
{
var idIsKnown =
_inputService.AskForBoolean("Do you know the key of the task you are working on? (example: CAT-102)");
if (!idIsKnown) return null;
var taskId = _inputService.AskForInput("What is the task key?");
return _taskService.GetTaskByName(taskId);
for (var i = 0; i < 3; i++)
{
var taskId = _inputService.AskForInput("What is the task key you are working on? (example: CAT-102)");
var task = _taskService.GetTaskByName(taskId);
if (task != null)
{
_outputService.ShowInformation("Ok you are working on:");
_outputService.ShowInformation(TaskString(task));
return task;
}
_outputService.ShowInformation("A task with that key was not found. Let's try again.");
}
return null;
}

static string TaskString(Task task)
Expand Down

0 comments on commit 82c0dce

Please sign in to comment.