Skip to content

Commit

Permalink
Fix daily stats labels when selecting month/year
Browse files Browse the repository at this point in the history
  • Loading branch information
bryansmit committed Dec 9, 2022
1 parent be54ffe commit 737cb1b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.0.7] - 2022-12-09

* Fix daily stats labels when selecting month/year.

## [3.0.6] - 2022-06-24

* Add description column to Redirects overview.
Expand Down
6 changes: 3 additions & 3 deletions controllers/Statistics.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function onLoadHitsPerDay(): array
$this->getHitsPerDayAsDataSet((int) $month, (int) $year, true),
$this->getHitsPerDayAsDataSet((int) $month, (int) $year, false),
], JSON_THROW_ON_ERROR),
'labels' => json_encode($this->getLabels(), JSON_THROW_ON_ERROR),
'labels' => json_encode($this->getLabels((int) $month, (int) $year), JSON_THROW_ON_ERROR),
'monthYearOptions' => $this->helper->getMonthYearOptions(),
'monthYearSelected' => $month . '_' . $year,
]),
Expand Down Expand Up @@ -125,11 +125,11 @@ public function onLoadScoreBoard(): array
];
}

private function getLabels(): array
private function getLabels(int $month, int $year): array
{
$labels = [];

foreach (Carbon::today()->firstOfMonth()->daysUntil(Carbon::today()->endOfMonth()) as $date) {
foreach (Carbon::create($year, $month)->firstOfMonth()->daysUntil(Carbon::create($year, $month)->endOfMonth()) as $date) {
$labels[] = $date->isoFormat('LL');
}

Expand Down
1 change: 1 addition & 0 deletions updates/version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,4 @@ v3.0.3: "Update plugin dependencies"
v3.0.4: "Improved compatibility/extensibility with other Plugins."
v3.0.5: "Lock to October CMS version 2.x. Support for October CMS 3 will be added in v3.1.0."
v3.0.6: "Add description column to Redirects overview."
v3.0.7: "Fix daily stats labels when selecting month/year."

0 comments on commit 737cb1b

Please sign in to comment.