/** * Test get sprint days. */ public function testGetSprintDays() { $sprint = new Sprint(); $sprint->setStart(new \DateTime('2016-04-12')); $sprint->setDuration($duration = new \DateInterval('P14D')); $days = new \DatePeriod(new \DateTime('2016-04-13'), new \DateInterval('P1D'), new \DateTime('2016-04-26')); $this->assertEquals($days, $sprint->getSprintDays()); }
/** * @return array|null */ public function getTheoreticalBurndown() { $theoreticalBurndown = []; $theoreticalBurndown[$this->sprint->getStart()->format('Y-m-d')] = $this->totalSP; $sprintDays = $this->sprint->getSprintDays(); if (!$sprintDays instanceof \DatePeriod) { return; } foreach ($sprintDays as $day) { if ($this->isWeekend($day)) { continue; } $rest = end($theoreticalBurndown) != false ? end($theoreticalBurndown) : $this->totalSP; $formatedDate = $this->formatDate($day); $doneSP = $rest - $this->averageSP; $theoreticalBurndown[$formatedDate] = round($doneSP, 2); } return $theoreticalBurndown; }
/** * Return an array of done story points per day. * * @param array $todoLists * @param array $wipLists * @param array $doneLists * @param Sprint $sprint * * @return array|null */ public function getDoneStoryPoints(array $todoLists, array $wipLists, array $doneLists, Sprint $sprint) { $doneCards = $this->actionManager->getCardsMovedFromTodoToDone($todoLists, $wipLists, $doneLists); $sprintDays = $sprint->getSprintDays(); $sp = []; if (!$sprintDays instanceof \DatePeriod) { return; } foreach ($sprintDays as $day) { $countSP = 0; if ($day instanceof \DateTime && $day->getTimestamp() > $sprint->getNextDayInSprint()->getTimestamp()) { break; } if ($this->isWeekend($day)) { continue; } foreach ($doneCards as $card) { $actionDate = new \DateTime($card['date']); if ($actionDate->getTimestamp() > $sprint->getStart()->getTimestamp() && $actionDate->getTimestamp() < $day->getTimestamp()) { $countSP += $this->parseStoryPoints($card['card']); } } $sp[] = ['date' => $day, 'count' => $countSP]; } return $sp; }