From af71913597dd479ebdacd8f72d58a5e4370498a7 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 25 May 2021 01:36:13 -0600 Subject: [PATCH 1/2] Update AdminStatsService, fix postgres bug --- app/Services/AdminStatsService.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Services/AdminStatsService.php b/app/Services/AdminStatsService.php index 4e0e642b..6c389e0c 100644 --- a/app/Services/AdminStatsService.php +++ b/app/Services/AdminStatsService.php @@ -67,10 +67,11 @@ class AdminStatsService protected static function postsGraph() { $ttl = now()->addHours(12); - return Cache::remember('admin:dashboard:home:data-postsGraph:v0:24hr', $ttl, function() { + return Cache::remember('admin:dashboard:home:data-postsGraph:v0.1:24hr', $ttl, function() { + $gb = config('database.default') == 'pgsql' ? ['statuses.id', DB::raw('Date(created_at)')] : DB::raw('Date(created_at)'); $s = Status::selectRaw('Date(created_at) as date, count(statuses.id) as count, statuses.*') ->where('created_at', '>=', now()->subWeek()) - ->groupBy(DB::raw('Date(created_at)')) + ->groupBy($gb) ->orderBy('created_at', 'DESC') ->pluck('count', 'date'); @@ -88,7 +89,7 @@ class AdminStatsService $s = Status::selectRaw('Date(created_at) as date, count(statuses.id) as count, statuses.*') ->where('created_at', '>=', now()->subWeeks(2)) ->where('created_at', '<=', now()->subWeeks(1)) - ->groupBy(DB::raw('Date(created_at)')) + ->groupBy($gb) ->orderBy('created_at', 'DESC') ->pluck('count', 'date'); From 55c3eaf26d8dfa544031233ca55b8a3a3af30769 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 25 May 2021 01:36:45 -0600 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ca60514..897cb722 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -94,6 +94,7 @@ - Updated StatusTransformer, fix missing tags attribute. ([dac326e9](https://github.com/pixelfed/pixelfed/commit/dac326e9)) - Updated ComposeController, bail on empty attachments. ([061b145b](https://github.com/pixelfed/pixelfed/commit/061b145b)) - Updated landing and about page. ([92dc7af6](https://github.com/pixelfed/pixelfed/commit/92dc7af6)) +- Updated AdminStatsService, fix postgres bug. ([af719135](https://github.com/pixelfed/pixelfed/commit/af719135)) - ([](https://github.com/pixelfed/pixelfed/commit/)) ## [v0.10.10 (2021-01-28)](https://github.com/pixelfed/pixelfed/compare/v0.10.9...v0.10.10)