* handle possible null values

* only update caches for enabled services
This commit is contained in:
Dávid Danyi 2018-09-17 17:24:46 +02:00
parent 66bc94037d
commit 15455f648e
3 changed files with 11 additions and 6 deletions

View File

@ -52,11 +52,14 @@ class UpdatePageCachesCommand extends Command
$this->createLock(); $this->createLock();
$teams = $this->teamService->listTeams(); $teams = $this->teamService->listTeams();
foreach ($teams as $team) { foreach ($teams as $team) {
set_time_limit(30); if ($team->isKanbanEnabled() && null !== $team->getFilterId()) {
if (null !== $team->getFilterId()) { set_time_limit(30);
$this->jiraCollectorService->getKanbanBoard($team->getId(), true); $this->jiraCollectorService->getKanbanBoard($team->getId(), true);
} }
$this->jiraCollectorService->getTeamWatchedIssues($team->getId(), true); if ($team->isWatchedEnabled()) {
set_time_limit(30);
$this->jiraCollectorService->getTeamWatchedIssues($team->getId(), true);
}
} }
$this->releaseLock(); $this->releaseLock();
} }

View File

@ -66,7 +66,7 @@ class WatchedIssue implements \JsonSerializable
* @param string $assignee * @param string $assignee
* @return WatchedIssue * @return WatchedIssue
*/ */
public function setAssignee(string $assignee): WatchedIssue public function setAssignee(?string $assignee): WatchedIssue
{ {
$this->assignee = $assignee; $this->assignee = $assignee;
return $this; return $this;
@ -84,7 +84,7 @@ class WatchedIssue implements \JsonSerializable
* @param WatchedIssueComment $comment * @param WatchedIssueComment $comment
* @return WatchedIssue * @return WatchedIssue
*/ */
public function setComment(WatchedIssueComment $comment): WatchedIssue public function setComment(?WatchedIssueComment $comment): WatchedIssue
{ {
$this->comment = $comment; $this->comment = $comment;
return $this; return $this;

View File

@ -223,7 +223,9 @@ class JiraCollectorService
* with JIRA jql at the moment. * with JIRA jql at the moment.
*/ */
return array_filter($hydratedResult, function(WatchedIssue $issue) use ($members) { return array_filter($hydratedResult, function(WatchedIssue $issue) use ($members) {
return !in_array($issue->getComment()->getSignum(), $members); return null !== $issue->getComment()
? !in_array($issue->getComment()->getSignum(), $members)
: false;
}); });
} }