From 9dd2525e9361aab78c35d13855ab30f68e870d18 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Sat, 12 Sep 2020 20:53:09 +0200 Subject: [PATCH] Metrics: Add theme names --- src/Controllers/Metrics/Controller.php | 5 +++++ tests/Feature/Controllers/Metrics/ControllerTest.php | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Controllers/Metrics/Controller.php b/src/Controllers/Metrics/Controller.php index 9fdf8fa6..138a5b29 100644 --- a/src/Controllers/Metrics/Controller.php +++ b/src/Controllers/Metrics/Controller.php @@ -72,6 +72,11 @@ class Controller extends BaseController $userLocales = $this->formatStats($this->stats->languages(), 'locales', 'language', 'locale'); $userThemes = $this->formatStats($this->stats->themes(), 'available_themes', 'theme'); + $themes = $this->config->get('available_themes'); + foreach ($userThemes as $key => $theme) { + $userThemes[$key]['labels']['name'] = $themes[$theme['labels']['theme']]; + } + $data = [ $this->config->get('app_name') . ' stats', 'info' => [ diff --git a/tests/Feature/Controllers/Metrics/ControllerTest.php b/tests/Feature/Controllers/Metrics/ControllerTest.php index 804fe620..1ff541a2 100644 --- a/tests/Feature/Controllers/Metrics/ControllerTest.php +++ b/tests/Feature/Controllers/Metrics/ControllerTest.php @@ -12,7 +12,11 @@ class ControllerTest extends ApplicationFeatureTest */ public function testMetrics() { - config(['api_key' => null, 'metrics' => ['work' => [60 * 60], 'voucher' => [1]]]); + config([ + 'api_key' => null, + 'metrics' => ['work' => [60 * 60], 'voucher' => [1]], + 'available_themes' => ['1' => 'Test'], + ]); /** @var Controller $controller */ $controller = app()->make(Controller::class);