mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-29 17:53:16 +00:00
Merge pull request #2956 from h3xx/fix-psql-grouping
Fix grouping error in PostgreSQL
This commit is contained in:
commit
59d76bb9b3
1 changed files with 3 additions and 3 deletions
|
@ -68,8 +68,8 @@ class AdminStatsService
|
||||||
{
|
{
|
||||||
$ttl = now()->addHours(12);
|
$ttl = now()->addHours(12);
|
||||||
return Cache::remember('admin:dashboard:home:data-postsGraph:v0.1: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)');
|
$gb = config('database.default') == 'pgsql' ? ['statuses.id', 'created_at'] : DB::raw('Date(created_at)');
|
||||||
$s = Status::selectRaw('Date(created_at) as date, count(statuses.id) as count, statuses.*')
|
$s = Status::selectRaw('Date(created_at) as date, count(statuses.id) as count')
|
||||||
->where('created_at', '>=', now()->subWeek())
|
->where('created_at', '>=', now()->subWeek())
|
||||||
->groupBy($gb)
|
->groupBy($gb)
|
||||||
->orderBy('created_at', 'DESC')
|
->orderBy('created_at', 'DESC')
|
||||||
|
@ -86,7 +86,7 @@ class AdminStatsService
|
||||||
|
|
||||||
$dates = collect($dates)->merge($s);
|
$dates = collect($dates)->merge($s);
|
||||||
|
|
||||||
$s = Status::selectRaw('Date(created_at) as date, count(statuses.id) as count, statuses.*')
|
$s = Status::selectRaw('Date(created_at) as date, count(statuses.id) as count')
|
||||||
->where('created_at', '>=', now()->subWeeks(2))
|
->where('created_at', '>=', now()->subWeeks(2))
|
||||||
->where('created_at', '<=', now()->subWeeks(1))
|
->where('created_at', '<=', now()->subWeeks(1))
|
||||||
->groupBy($gb)
|
->groupBy($gb)
|
||||||
|
|
Loading…
Reference in a new issue