fix: check if absence is cancellable in expiry check instead
Approved & pending absences can be cancelled. Initial actionability check only accounts for pending absences. Fixes issue where expired absences wouldn't be ended. Signed-off-by: miguel456 <me@nogueira.codes>
This commit is contained in:
parent
228750e1c3
commit
0941023aef
@ -167,12 +167,16 @@ class AbsenceService
|
||||
return $absence->delete();
|
||||
}
|
||||
|
||||
|
||||
public function endExpired()
|
||||
/**
|
||||
* End all expired absences in the application
|
||||
* @return void
|
||||
*/
|
||||
public function endExpired(): void
|
||||
{
|
||||
foreach (Absence::all() as $absence)
|
||||
{
|
||||
if (!Carbon::parse($absence->predicted_end)->isFuture() && $absence->isActionable()) {
|
||||
// tell the absence we want to check for cancelability
|
||||
if (!Carbon::parse($absence->predicted_end)->isFuture() && $absence->isActionable(true)) {
|
||||
$this->endAbsence($absence);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user