From 5d5b1fc3e7457e3d39d6eac10e45cfb21d4c30ee Mon Sep 17 00:00:00 2001 From: DariusIII Date: Wed, 20 Mar 2019 15:39:32 +0100 Subject: [PATCH] Fix site stats admin page --- Changelog | 1 + app/Models/Category.php | 4 ++-- resources/views/themes/admin/site-stats.tpl | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Changelog b/Changelog index d0359174b..e976814b0 100755 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ 2019-03-20 DariusIII + * Fix: Fix site stats admin page * Chg: Update return type declarations on adult postprocessing classes * Chg: Update dariusiii/rarinfo (v2.7.4 => v2.7.4.1) * Chg: Update dariusiii/rarinfo (v2.7.3 => v2.7.4) diff --git a/app/Models/Category.php b/app/Models/Category.php index e6af7233d..667dc83eb 100644 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -2,6 +2,7 @@ namespace App\Models; +use Illuminate\Support\Facades\DB; use Watson\Rememberable\Rememberable; use Illuminate\Database\Eloquent\Model; @@ -276,8 +277,7 @@ class Category extends Model ->with('parent') ->remember(config('nntmux.cache_expiry_long')) ->where('r.adddate', '>', now()->subWeek()) - ->selectRaw('CONCAT(cp.title, " > ", categories.title) as title') - ->selectRaw('COUNT(r.id) as count') + ->select(['root_categories_id', DB::raw('COUNT(r.id) as count'), 'title']) ->join('releases as r', 'r.categories_id', '=', 'categories.id') ->groupBy('title') ->orderBy('count', 'desc') diff --git a/resources/views/themes/admin/site-stats.tpl b/resources/views/themes/admin/site-stats.tpl index acf414781..02b3e5908 100644 --- a/resources/views/themes/admin/site-stats.tpl +++ b/resources/views/themes/admin/site-stats.tpl @@ -106,7 +106,7 @@ {foreach from=$recent item=result} - {$result->title} + {$result->parent->title} > {$result->title} {$result.count} {/foreach}