* worklog time spent added

This commit is contained in:
Dávid Danyi 2017-08-24 17:14:05 +02:00
parent 1ab6691827
commit 09b2fd2c5f
3 changed files with 31 additions and 0 deletions

View File

@ -21,6 +21,7 @@ return [
'labels',
'assignee',
'status',
'worklog',
'customfield_10010',
'customfield_11226',
'customfield_10840',

View File

@ -112,6 +112,11 @@ class KanbanEntry implements \JsonSerializable
*/
private $answerCode;
/**
* @var int
*/
private $worklog = 0;
/**
* KanbanEntry constructor.
*/
@ -486,6 +491,24 @@ class KanbanEntry implements \JsonSerializable
return $this;
}
/**
* @return int
*/
public function getWorklog(): int
{
return $this->worklog;
}
/**
* @param int $worklog
* @return KanbanEntry
*/
public function setWorklog(int $worklog): KanbanEntry
{
$this->worklog = $worklog;
return $this;
}
/**
* @return array
*/
@ -511,6 +534,7 @@ class KanbanEntry implements \JsonSerializable
'mhwebExternal' => $this->getMhwebExternal(),
'team' => $this->getTeam(),
'answerCode' => $this->getAnswerCode(),
'worklog' => $this->getWorklog(),
];
}
}

View File

@ -92,6 +92,12 @@ class JiraCollectorService
->setLabels($jsonIssue['fields']['labels'])
;
$timeSpent = 0;
array_map(function($worklog) use (&$timeSpent){
$timeSpent += $worklog['timeSpentSeconds'];
}, $jsonIssue['fields']['worklog']['worklogs']);
$kanbanEntry->setWorklog(ceil($timeSpent/3600));
// externalId : customfield_10010
if(isset($jsonIssue['fields']['customfield_10010'])) {
$kanbanEntry->setPrio(intval($jsonIssue['fields']['customfield_10010']));