Skip to content

Commit fbb0ff3

Browse files
committed
Fix stats parsing
1 parent 38b3b5f commit fbb0ff3

File tree

5 files changed

+7
-4
lines changed

5 files changed

+7
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ access.log
1313
access_big.log
1414
access_short.log
1515
sync-db.sh
16+
app/tempest-access.log

app/Analytics/PackageDownloadsPerDay/PackageDownloadsPerDayProjector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function onPackageDownloadsListed(PackageDownloadsListed $event): void
3535

3636
PackageDownloadsPerDay::updateOrCreate(
3737
[
38-
'date' => $event->date->format('Y-m-d 00:00:00'),
38+
'date' => $event->date->format(DATE_ATOM),
3939
'package' => $event->package,
4040
],
4141
[

app/Analytics/PackageDownloadsPerHour/PackageDownloadsPerHourProjector.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ public function onPackageDownloadsListed(PackageDownloadsListed $event): void
3333

3434
$count = max($count, 0);
3535

36+
$date = $event->date->setTime($event->date->format('H'), 0, 0);
37+
3638
PackageDownloadsPerHour::updateOrCreate(
3739
[
38-
'date' => $event->date->format('Y-m-d H:00:00'),
40+
'date' => $date->format(DATE_ATOM),
3941
'package' => $event->package,
4042
],
4143
[

app/Analytics/VisitsPerDay/VisitsPerDayProjector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function onPageVisited(PageVisited $pageVisited): void
3232
$visitedAt = $pageVisited->visitedAt->setTime(0, 0);
3333

3434
$day = VisitsPerDay::query()
35-
->whereField('date', $visitedAt->format('Y-m-d H:i:s'))
35+
->whereField('date', $visitedAt->format(DATE_ATOM))
3636
->first();
3737

3838
if (! $day) {

app/Analytics/VisitsPerHour/VisitsPerHourProjector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function onPageVisited(PageVisited $pageVisited): void
3535
);
3636

3737
$day = VisitsPerHour::query()
38-
->whereField('date', $visitedAt->format('Y-m-d H:i:s'))
38+
->whereField('date', $visitedAt->format(DATE_ATOM))
3939
->first();
4040

4141
if (! $day) {

0 commit comments

Comments
 (0)