* watcher cache filename fixed
This commit is contained in:
parent
bb937a664b
commit
c7a2e68a82
@ -94,6 +94,7 @@ class JiraCollectorService
|
|||||||
if ($forceReload || null === $kanbanBoard) {
|
if ($forceReload || null === $kanbanBoard) {
|
||||||
$user = $this->config->get('jira.user');
|
$user = $this->config->get('jira.user');
|
||||||
$password = $this->config->get('jira.password');
|
$password = $this->config->get('jira.password');
|
||||||
|
|
||||||
/** @var Config $kanbanBoardUriParams */
|
/** @var Config $kanbanBoardUriParams */
|
||||||
$kanbanBoardUri = $this->config->get('url.jiraKanbanBoard');
|
$kanbanBoardUri = $this->config->get('url.jiraKanbanBoard');
|
||||||
$kanbanBoardFilter = $this->config->get('jira.filterFields')->toArray();
|
$kanbanBoardFilter = $this->config->get('jira.filterFields')->toArray();
|
||||||
@ -141,11 +142,13 @@ class JiraCollectorService
|
|||||||
return $member['signum'];
|
return $member['signum'];
|
||||||
}, $team->getMembers());
|
}, $team->getMembers());
|
||||||
$preparedMembers = sprintf('"%s"', implode('","', $members));
|
$preparedMembers = sprintf('"%s"', implode('","', $members));
|
||||||
|
|
||||||
$filter = sprintf(
|
$filter = sprintf(
|
||||||
self::WATCH_FILTER,
|
self::WATCH_FILTER,
|
||||||
sprintf('"%s"', implode('","', self::IGNORED_STATUSES)),
|
sprintf('"%s"', implode('","', self::IGNORED_STATUSES)),
|
||||||
$preparedMembers, $preparedMembers
|
$preparedMembers, $preparedMembers
|
||||||
);
|
);
|
||||||
|
|
||||||
$user = $this->config->get('jira.user');
|
$user = $this->config->get('jira.user');
|
||||||
$password = $this->config->get('jira.password');
|
$password = $this->config->get('jira.password');
|
||||||
/** @var Config $kanbanBoardUriParams */
|
/** @var Config $kanbanBoardUriParams */
|
||||||
@ -156,8 +159,8 @@ class JiraCollectorService
|
|||||||
'comment',
|
'comment',
|
||||||
];
|
];
|
||||||
$issueFields = implode(",", $kanbanBoardFilterFields);
|
$issueFields = implode(",", $kanbanBoardFilterFields);
|
||||||
$jiraIssueUri = sprintf($jiraWatchedIssues, $filter, $issueFields);
|
|
||||||
|
|
||||||
|
$jiraIssueUri = sprintf($jiraWatchedIssues, $filter, $issueFields);
|
||||||
$response = $this->httpClient
|
$response = $this->httpClient
|
||||||
->setUri($jiraIssueUri)
|
->setUri($jiraIssueUri)
|
||||||
->setAuth($user, $password)
|
->setAuth($user, $password)
|
||||||
@ -171,7 +174,7 @@ class JiraCollectorService
|
|||||||
}
|
}
|
||||||
|
|
||||||
$watchedIssues = $this->hydrateWatchedIssues(Decoder::decode($response->getBody(), Json::TYPE_ARRAY), $members);
|
$watchedIssues = $this->hydrateWatchedIssues(Decoder::decode($response->getBody(), Json::TYPE_ARRAY), $members);
|
||||||
$this->cache->setItem(sprintf("%s-%s", self::CACHE_KEY_KANBANBOARD, $teamName), serialize($watchedIssues));
|
$this->cache->setItem(sprintf("%s-%s", self::CACHE_KEY_WATCHED, $teamName), serialize($watchedIssues));
|
||||||
return $watchedIssues;
|
return $watchedIssues;
|
||||||
}
|
}
|
||||||
return unserialize($watchedIssues);
|
return unserialize($watchedIssues);
|
||||||
@ -193,6 +196,7 @@ class JiraCollectorService
|
|||||||
$issueItem->setIssue($issueJson['key'])
|
$issueItem->setIssue($issueJson['key'])
|
||||||
->setAssignee($issueJson['fields']['assignee']['name'])
|
->setAssignee($issueJson['fields']['assignee']['name'])
|
||||||
->setSummary(html_entity_decode($issueJson['fields']['summary']));
|
->setSummary(html_entity_decode($issueJson['fields']['summary']));
|
||||||
|
|
||||||
$issueComments = [];
|
$issueComments = [];
|
||||||
foreach ($issueJson['fields']['comment']['comments'] as $commentJson) {
|
foreach ($issueJson['fields']['comment']['comments'] as $commentJson) {
|
||||||
$issueComment = new WatchedIssueComment();
|
$issueComment = new WatchedIssueComment();
|
||||||
@ -202,12 +206,15 @@ class JiraCollectorService
|
|||||||
->setDate(new \DateTimeImmutable($commentJson['updated']));
|
->setDate(new \DateTimeImmutable($commentJson['updated']));
|
||||||
$issueComments[] = $issueComment;
|
$issueComments[] = $issueComment;
|
||||||
}
|
}
|
||||||
|
|
||||||
usort($issueComments, function(WatchedIssueComment $a, WatchedIssueComment $b) {
|
usort($issueComments, function(WatchedIssueComment $a, WatchedIssueComment $b) {
|
||||||
return $a->getDate() <=> $b->getDate();
|
return $a->getDate() <=> $b->getDate();
|
||||||
});
|
});
|
||||||
|
|
||||||
$lastComment = array_pop($issueComments);
|
$lastComment = array_pop($issueComments);
|
||||||
unset($issueComments);
|
unset($issueComments);
|
||||||
$issueItem->setComment($lastComment);
|
$issueItem->setComment($lastComment);
|
||||||
|
|
||||||
$hydratedResult[] = $issueItem;
|
$hydratedResult[] = $issueItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user