Skip to content

Commit

Permalink
Merge pull request #30 from technodelight/feature/add-move-option
Browse files Browse the repository at this point in the history
Add move option, fixes
  • Loading branch information
technodelight authored Dec 15, 2016
2 parents 69ca589 + 15a8524 commit 3743378
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Technodelight/Jira/Api/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function worklog($issueKey, $timeSpent, $comment, $started, $adjustEstima
sprintf('issue/%s/worklog', $issueKey) . '?' . http_build_query($params),
[
'comment' => $comment,
'started' => $started,
'started' => DateHelper::dateTimeToJira($started),
'timeSpent' => $timeSpent,
]
);
Expand Down
2 changes: 1 addition & 1 deletion src/Technodelight/Jira/Api/Worklog.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static function fromArray(array $record, $issueKey)
$record['id'],
$record['author']['displayName'],
isset($record['comment']) ? $record['comment'] : null,
DateHelper::dateTimeFromJira($record['started'])->format('Y-m-d'),
DateHelper::dateTimeFromJira($record['started'])->format('Y-m-d H:i:s'),
$record['timeSpent'],
$record['timeSpentSeconds']
);
Expand Down
14 changes: 10 additions & 4 deletions src/Technodelight/Jira/Console/Command/LogTimeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ protected function configure()
InputOption::VALUE_NONE,
'Delete worklog'
)
->addOption(
'move',
'm',
InputOption::VALUE_REQUIRED,
'Move worklog to another date'
)
;
}

Expand All @@ -68,7 +74,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$input->setArgument('issueKey', $issueKey);
}

if ($input->getOption('delete')) {
if ($input->getOption('delete') || $input->getOption('move')) {
return;
}

Expand Down Expand Up @@ -120,7 +126,7 @@ function ($answer) {
false
);

$input->setArgument('comment', $comment);
$input->setArgument('comment', $comment ?: $defaultMessage);
}
}

Expand All @@ -132,7 +138,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$issueKey = $this->issueKeyArgument($input);
$timeSpent = $input->getArgument('time') ?: null;
$comment = $input->getArgument('comment') ?: null;
$startDay = $input->getArgument('date') ?: null;
$startDay = $input->getArgument('date') ?: $input->getOption('move');

if (intval($issueKey)) {
try {
Expand Down Expand Up @@ -205,7 +211,7 @@ private function logNewWork($issueKey, $timeSpent, $comment, $startDay)
$issueKey,
$timeSpent,
$comment ?: sprintf('Worked on issue %s', $issueKey),
DateHelper::dateTimeToJira($startDay ?: 'today')
$startDay ?: 'today'
);

$issue = $jira->retrieveIssue($issueKey);
Expand Down

0 comments on commit 3743378

Please sign in to comment.