Skip to content

Commit

Permalink
Merge pull request #29 from mtrojanowski/configure_monolog
Browse files Browse the repository at this point in the history
Fix archive rankings
  • Loading branch information
Michał Trojanowski committed Jun 20, 2019
2 parents ae39ca1 + 66ee1f7 commit 04b40e7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/src/Controller/RankingController.php
Expand Up @@ -54,7 +54,8 @@ public function list(Request $request, string $seasonId = null) {
);
}

$rankingData = new RankingDataDto($ranking, new \DateTime('@'.$season->getRankingLastModified()));
$modificationDate = $season->getRankingLastModified() != null ? new \DateTime('@'.$season->getRankingLastModified()) : null;
$rankingData = new RankingDataDto($ranking, $modificationDate);

return $this->json($this->getSerializer()->normalize($rankingData, 'json'));
}
Expand Down
4 changes: 2 additions & 2 deletions src/src/Controller/dto/RankingDataDto.php
Expand Up @@ -14,7 +14,7 @@ class RankingDataDto
* @param array $ranking
* @param \DateTime $rankingLastModified
*/
public function __construct(array $ranking, \DateTime $rankingLastModified = null)
public function __construct(array $ranking, ?\DateTime $rankingLastModified)
{
$this->ranking = $ranking;
$this->rankingLastModified = $rankingLastModified;
Expand All @@ -33,7 +33,7 @@ public function getRanking(): array
*/
public function getRankingLastModified()
{
return $this->rankingLastModified->format('Y-m-d H:i');
return $this->rankingLastModified != null ? $this->rankingLastModified->format('Y-m-d H:i') : "";
}

}

0 comments on commit 04b40e7

Please sign in to comment.