public function setViewData() { $userService = Factory::getInstance()->getUserService(); $issues = $userService->getMemberDetailData($this->userId); $user = Factory::getInstance()->getUserRepository()->getUserByPk($this->userId); $this->setVariables(['issues' => $issues, 'userName' => $user['name']], true); }
private function removeCache() { $cache = Cache::getAdapter(); $cache->removeItem(ProjectService::CACHE_KEY_WEEK); $cache->removeItem(ProjectService::CACHE_KEY_SUM); $cache->removeItem(UserService::CACHE_KEY_WEEK); $cache->removeItem(UserService::CACHE_KEY_MONTH); $memberIds = Factory::getInstance()->getUserRepository()->getUserIds(); foreach ($memberIds as $id) { $cache->removeItem(UserService::CACHE_KEY_WEEK_USER . '-' . $id); $cache->removeItem(UserService::CACHE_KEY_MONTH_USER . '-' . $id); } }
public function getProjectsSumData() { $cache = Cache::getAdapter(); $result = $cache->getItem(self::CACHE_KEY_SUM, $success); if ($success) { return unserialize($result); } else { $projectRows = Factory::getInstance()->getProjectRepository()->getAll(); $projects = Ginq::from($projectRows)->orderBy(function ($projectRow) { return $projectRow['archived'] == true ? 1 : 0; })->thenBy(function ($projectRow) { return $projectRow['id']; })->renum()->toArray(); $result = Ginq::from($projects)->select(function ($project) { $issues = Factory::getInstance()->getIssueRepository()->getIssueByProjectId($project['id']); $estimatedHours = Ginq::from($issues)->sum(function ($issue) { return $issue['estimatedHours']; }); $actualHours = Ginq::from($issues)->sum(function ($issue) { return $issue['actualHours']; }); $backlogUrl = 'https://' . AbstractRepository::$spaceName . '.backlog.jp/gantt/' . $project['projectKey']; $projectSumInfo = new ProjectSumInfo(); $projectSumInfo->setProjectName($project['name']); $archived = $project['archived'] === true ? '◯' : ''; $projectSumInfo->setArchived($archived); $orderAmount = OrderAmount::getOrderAmountByProjectKey($project['projectKey']); $totalManHour = OrderAmount::getTotalManHourByProjectKey($project['projectKey']); $projectSumInfo->setTotalManHour($totalManHour); $outsourcingCost = OrderAmount::getOutsourcingByProjectKey($project['projectKey']); $projectSumInfo->setOutsourcingCost($outsourcingCost); $projectSumInfo->setOrderAmount($orderAmount); $projectSumInfo->setSumEstimatedHours($estimatedHours); $projectSumInfo->setSumActualHours($actualHours); $estimatedCost = (int) $estimatedHours * Cost::getCostPerHourPerPerson(); $projectSumInfo->setSumEstimatedCost($estimatedCost); $actualCost = $actualHours * Cost::getCostPerHourPerPerson(); $projectSumInfo->setSumActualCost($actualCost); $projectSumInfo->setBackLogUrl($backlogUrl); $projectSumInfo->setCostCompare($orderAmount - $actualCost - $outsourcingCost); return $projectSumInfo; })->toArray(); $cache->setItem(self::CACHE_KEY_SUM, serialize($result)); } return $result; }
public function setViewData() { $userService = Factory::getInstance()->getUserService(); $members = $userService->getMembersData(); $this->setVariables(['members' => $members], true); }
public function setViewData() { $projectService = Factory::getInstance()->getProjectService(); $projects = $projectService->getProjectsData(); $this->setVariables(['projects' => $projects], true); }
public function getMemberMonthDetailData($userId) { $cache = Cache::getAdapter(); $result = $cache->getItem(self::CACHE_KEY_MONTH_USER . '-' . $userId, $success); if ($success) { return unserialize($result); } else { $issues = Factory::getInstance()->getIssueRepository()->getIssueByProjectIdAndStartMonthDate($userId); $result = Ginq::from($issues)->select(function ($issue) { $project = Factory::getInstance()->getProjectRepository()->getProjectByPk($issue['projectId']); $userDetail = new UserDetail(); $userDetail->setProjectName($project['name']); $userDetail->setThisWeekEstimatedHours($issue['estimatedHours']); $userDetail->setThisWeekActualHours($issue['actualHours']); $userDetail->setSummary($issue['summary']); $userDetail->setPriority($issue['priority']['name']); $userDetail->setStatus($issue['status']['name']); return $userDetail; })->toArray(); $cache->setItem(self::CACHE_KEY_MONTH_USER . '-' . $userId, serialize($result)); } return $result; }
public function setViewData() { $projectService = Factory::getInstance()->getProjectService(); $projects = $projectService->getProjectsSumData(); $this->setVariables(['projects' => $projects, 'perHourPerPerson' => Cost::getCostPerHourPerPerson()], true); }
public function indexAction() { $tallyService = Factory::getInstance()->getTallyService(); $tallyService->exec(); return $this->redirect()->toRoute('application'); }