From 53142e2c936d04019030250b8363694e5c26bc3c Mon Sep 17 00:00:00 2001 From: Nico Stapelbroek Date: Sun, 21 Jan 2018 13:35:30 +0100 Subject: [PATCH] Fix a bug where notifications are send because the end of the maintenance time is set --- app/Integrations/Core/System.php | 2 +- app/Models/Schedule.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Integrations/Core/System.php b/app/Integrations/Core/System.php index 4fe0c455..87afeafc 100644 --- a/app/Integrations/Core/System.php +++ b/app/Integrations/Core/System.php @@ -115,7 +115,7 @@ class System implements SystemContract return true; } - return !$this->config->get('suppress_notifications_in_maintenance'); + return !$this->config->get('setting.suppress_notifications_in_maintenance'); } /** diff --git a/app/Models/Schedule.php b/app/Models/Schedule.php index f5d1fd77..c5f55a96 100644 --- a/app/Models/Schedule.php +++ b/app/Models/Schedule.php @@ -161,7 +161,9 @@ class Schedule extends Model implements HasPresenter */ public function scopeInProgress(Builder $query) { - return $query->where('scheduled_at', '<=', Carbon::now())->whereNull('completed_at')->where('status', '!=', self::COMPLETE); + return $query->where('scheduled_at', '<=', Carbon::now())->where('status', '!=', self::COMPLETE)->where(function($query) { + $query->whereNull('completed_at')->orWhere('completed_at','>', Carbon::now()); + }); } /**