From 8f005718e087ea81464acdef26702120b61eafc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20Danyi?= Date: Wed, 29 Nov 2017 16:59:11 +0100 Subject: [PATCH] * taurus prio added * order by taurus prio --- config/autoload/local.php.dist | 1 + src/App/Entity/KanbanBoard.php | 33 ++++++++++++------------ src/App/Entity/KanbanEntry.php | 26 +++++++++++++++++++ src/App/Service/JiraCollectorService.php | 5 ++++ 4 files changed, 49 insertions(+), 16 deletions(-) diff --git a/config/autoload/local.php.dist b/config/autoload/local.php.dist index 8d23cbf..8463c74 100644 --- a/config/autoload/local.php.dist +++ b/config/autoload/local.php.dist @@ -74,6 +74,7 @@ return [ 'customfield_10904', 'customfield_11692', 'customfield_10401', + 'customfield_12500', ], ], 'url.mhWebPraGoals' => 'https://mhweb.ericsson.se:443/SearchWeb/faces/search/query/resultPage.xhtml?&v=3&queryKey=74023&output=CSV&csvDelimiter=COMMA', diff --git a/src/App/Entity/KanbanBoard.php b/src/App/Entity/KanbanBoard.php index 15bbf3c..9716295 100644 --- a/src/App/Entity/KanbanBoard.php +++ b/src/App/Entity/KanbanBoard.php @@ -6,19 +6,19 @@ use Doctrine\Common\Collections\ArrayCollection; class KanbanBoard implements \JsonSerializable { - const PRIO_TRIVIAL = 0; - const PRIO_MINOR = 1; - const PRIO_MAJOR = 2; - const PRIO_CRITICAL = 3; - const PRIO_BLOCKER = 4; +// const PRIO_TRIVIAL = 0; +// const PRIO_MINOR = 1; +// const PRIO_MAJOR = 2; +// const PRIO_CRITICAL = 3; +// const PRIO_BLOCKER = 4; - private $priorityMap = [ - 'Trivial' => self::PRIO_TRIVIAL, - 'Minor' => self::PRIO_MINOR, - 'Major' => self::PRIO_MAJOR, - 'Critical' => self::PRIO_CRITICAL, - 'Blocker' => self::PRIO_BLOCKER, - ]; +// private $priorityMap = [ +// 'Trivial' => self::PRIO_TRIVIAL, +// 'Minor' => self::PRIO_MINOR, +// 'Major' => self::PRIO_MAJOR, +// 'Critical' => self::PRIO_CRITICAL, +// 'Blocker' => self::PRIO_BLOCKER, +// ]; /** * @var KanbanEntry[]|ArrayCollection @@ -222,8 +222,9 @@ class KanbanBoard implements \JsonSerializable */ private function prioSort(array $toSort): array { - usort($toSort, function(KanbanEntry $a, KanbanEntry $b){ - return $this->priorityMap[$b->getIssuePriority()] <=> $this->priorityMap[$a->getIssuePriority()]; + usort($toSort, function (KanbanEntry $a, KanbanEntry $b) { + return $a->getTaurusPrio() <=> $b->getTaurusPrio(); +// return $this->priorityMap[$b->getIssuePriority()] <=> $this->priorityMap[$a->getIssuePriority()]; }); return $toSort; } @@ -234,10 +235,10 @@ class KanbanBoard implements \JsonSerializable */ private function updatedAtReverseSort(array $toSort): array { - $toSort = array_filter($toSort, function(KanbanEntry $item){ + $toSort = array_filter($toSort, function (KanbanEntry $item) { return $item->getAssignee() != null && empty($item->getFixVersions()); }); - usort($toSort, function(KanbanEntry $a, KanbanEntry $b){ + usort($toSort, function (KanbanEntry $a, KanbanEntry $b) { return $b->getUpdatedAt() <=> $a->getUpdatedAt(); }); return $toSort; diff --git a/src/App/Entity/KanbanEntry.php b/src/App/Entity/KanbanEntry.php index 011f78f..1dbb401 100644 --- a/src/App/Entity/KanbanEntry.php +++ b/src/App/Entity/KanbanEntry.php @@ -123,6 +123,13 @@ class KanbanEntry implements \JsonSerializable */ private $answerCode; + /** + * ITS OVER 9000! + * JIRA: customfield_12500 + * @var int + */ + private $taurusPrio = 9001; + /** * @var int */ @@ -573,6 +580,24 @@ class KanbanEntry implements \JsonSerializable return $this; } + /** + * @return int + */ + public function getTaurusPrio(): ?int + { + return $this->taurusPrio; + } + + /** + * @param int $taurusPrio + * @return KanbanEntry + */ + public function setTaurusPrio(?int $taurusPrio): KanbanEntry + { + $this->taurusPrio = $taurusPrio; + return $this; + } + /** * @return int */ @@ -653,6 +678,7 @@ class KanbanEntry implements \JsonSerializable 'mhwebExternal' => $this->getMhwebExternal(), 'team' => $this->getTeam(), 'answerCode' => $this->getAnswerCode(), + 'taurusPrio' => $this->getTaurusPrio(), 'worklog' => $this->getWorklog(), 'daysBlocked' => $this->getDaysBlocked(), 'updatedAt' => $this->getUpdatedAt(), diff --git a/src/App/Service/JiraCollectorService.php b/src/App/Service/JiraCollectorService.php index aa29111..4b7d70d 100644 --- a/src/App/Service/JiraCollectorService.php +++ b/src/App/Service/JiraCollectorService.php @@ -225,6 +225,11 @@ class JiraCollectorService $kanbanEntry->setTeam($jsonIssue['fields']['customfield_10904']['value']); } + // team : customfield_12500 + if (isset($jsonIssue['fields']['customfield_12500'])) { + $kanbanEntry->setTaurusPrio($jsonIssue['fields']['customfield_12500']); + } + // jira status $jiraStatus = new JiraStatus(); $jiraStatus->setName($jsonIssue['fields']['status']['name'])