From 9ece209c7241ea04e186c68cb5c1932ebdca0cce Mon Sep 17 00:00:00 2001 From: James Cole Date: Thu, 6 Sep 2018 13:05:15 +0200 Subject: [PATCH] Add two new ranges #954 --- .../Http/Controllers/GetConfigurationData.php | 13 ++++++++++++- resources/lang/en_US/firefly.php | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/Support/Http/Controllers/GetConfigurationData.php b/app/Support/Http/Controllers/GetConfigurationData.php index 2c46da121c..e8c4ea93ac 100644 --- a/app/Support/Http/Controllers/GetConfigurationData.php +++ b/app/Support/Http/Controllers/GetConfigurationData.php @@ -168,6 +168,16 @@ trait GetConfigurationData $ranges[ucfirst((string)trans('firefly.today'))] = [$todayStart, $todayEnd]; } + // last seven days: + $seven = Carbon::create()->subDays(7); + $index = (string)trans('firefly.last_seven_days'); + $ranges[$index] = [$seven, new Carbon]; + + // last 30 days: + $thirty = Carbon::create()->subDays(30); + $index = (string)trans('firefly.last_thirty_days'); + $ranges[$index] = [$thirty, new Carbon]; + // everything $index = (string)trans('firefly.everything'); $ranges[$index] = [$first, new Carbon]; @@ -259,9 +269,10 @@ trait GetConfigurationData $now = time(); if (0 === $lastTime) { request()->session()->flash('info', trans('firefly.recurring_never_cron')); + return; } - if($now - $lastTime > 129600) { + if ($now - $lastTime > 129600) { request()->session()->flash('warning', trans('firefly.recurring_cron_long_ago')); } } diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php index 9bff536932..3ddb4c3e13 100644 --- a/resources/lang/en_US/firefly.php +++ b/resources/lang/en_US/firefly.php @@ -30,6 +30,8 @@ return [ 'delete' => 'Delete', 'split' => 'Split', 'clone' => 'Clone', + 'last_seven_days' => 'Last seven days', + 'last_thirty_days' => 'Last thirty days', 'welcomeBack' => 'What\'s playing?', 'everything' => 'Everything', 'today' => 'today',