Skip to content

Commit

Permalink
fixes Pages views result for today/yesterday
Browse files Browse the repository at this point in the history
  • Loading branch information
bezhanSalleh committed Oct 22, 2024
1 parent 2e1a7f0 commit 96e14dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/Traits/ActiveUsers.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ private function performActiveUsersQuery(string $metric, int $days): array

$results = $analyticsData->mapWithKeys(function ($row) use ($metric) {
return [
//(new Carbon($row['date']))->format('M j') => intval($row[1]),
(new Carbon($row['date']))->format('M j') => $row[$metric],
];
});
Expand Down
8 changes: 4 additions & 4 deletions src/Traits/PageViews.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ private function pageViewsToday(): array
$analyticsData = Analytics::fetchTotalVisitorsAndPageViews(Period::days(1));

return [
'result' => $analyticsData->last()['screenPageViews'] ?? 0,
'previous' => $analyticsData->first()['screenPageViews'] ?? 0,
'result' => $analyticsData->first()['screenPageViews'] ?? 0,
'previous' => $analyticsData->last()['screenPageViews'] ?? 0,
];
}

Expand All @@ -25,8 +25,8 @@ private function pageViewsYesterday(): array
$analyticsData = Analytics::fetchTotalVisitorsAndPageViews(Period::create(Carbon::yesterday()->clone()->subDay(), Carbon::yesterday()));

return [
'result' => $analyticsData->last()['screenPageViews'] ?? 0,
'previous' => $analyticsData->first()['screenPageViews'] ?? 0,
'result' => $analyticsData->first()['screenPageViews'] ?? 0,
'previous' => $analyticsData->last()['screenPageViews'] ?? 0,
];
}

Expand Down

0 comments on commit 96e14dc

Please sign in to comment.