Skip to content

Commit

Permalink
refactor(resources): Use constants for readability
Browse files Browse the repository at this point in the history
  • Loading branch information
zooley committed Mar 27, 2024
1 parent d16b100 commit 129f186
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/Modules/Resources/Console/EmailSchedulingCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function handle(): void
->join($c, $c . '.subresourceid', $s . '.id')
->join($a, $a . '.id', $c . '.resourceid')
->whereNull($a . '.datetimeremoved')
->where($s . '.notice', '=', 2)
->where($s . '.notice', '=', Subresource::NOTICE_JUST_STOPPED)
->get();

if (count($stopped))
Expand All @@ -72,7 +72,7 @@ public function handle(): void

foreach ($stopped as $subresource)
{
$subresource->update(['notice' => 3]);
$subresource->update(['notice' => Subresource::NOTICE_STILL_STOPPED]);
}
}
}
Expand All @@ -86,15 +86,15 @@ public function handle(): void
->join($c, $c . '.subresourceid', $s . '.id')
->join($a, $a . '.id', $c . '.resourceid')
->whereNull($a . '.datetimeremoved')
->where($s . '.notice', '=', 1)
->where($s . '.notice', '=', Subresource::NOTICE_JUST_STARTED)
->get();

$stopped = Subresource::query()
->select($s . '.*')
->join($c, $c . '.subresourceid', $s . '.id')
->join($a, $a . '.id', $c . '.resourceid')
->whereNull($a . '.datetimeremoved')
->where($s . '.notice', '=', 3)
->where($s . '.notice', '=', Subresource::NOTICE_STILL_STOPPED)
->get();

if (count($started))
Expand Down Expand Up @@ -123,7 +123,7 @@ public function handle(): void

foreach ($started as $subresource)
{
$subresource->update(['notice' => 0]);
$subresource->update(['notice' => Subresource::NO_NOTICE]);
}
}
elseif ($debug || $this->output->isVerbose())
Expand Down

0 comments on commit 129f186

Please sign in to comment.