From ff593efc0e33c2261d3f4d8a1b209c8a281fe5e6 Mon Sep 17 00:00:00 2001 From: Lewis Larsen Date: Mon, 24 Jun 2024 18:12:23 +0100 Subject: [PATCH] refactor: if statements in eligible to run method --- app/Models/BackupTask.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/Models/BackupTask.php b/app/Models/BackupTask.php index c3dbc290..81b11420 100644 --- a/app/Models/BackupTask.php +++ b/app/Models/BackupTask.php @@ -194,12 +194,13 @@ public function eligibleToRunNow(): bool if ($this->isReady() && $this->usingCustomCronExpression()) { return $this->cronExpressionMatches(); } - - if ($this->isReady() && ! $this->usingCustomCronExpression()) { - return $this->isTheRightTimeToRun(); + if (!$this->isReady()) { + return false; } - - return false; + if ($this->usingCustomCronExpression()) { + return false; + } + return $this->isTheRightTimeToRun(); } public function cronExpressionMatches(): bool