Skip to content

Commit

Permalink
Improve occurrence notification
Browse files Browse the repository at this point in the history
Just notify twice in the same mode
  • Loading branch information
jesusantguerrero authored Dec 24, 2024
1 parent 455f3c1 commit abac4f8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/Domains/Housing/Models/Occurrence.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,13 @@ public function diffWithLastDuration() {
}

public function isCloseToAvg() {

return $this->currentCount() >= $this->avg_days_passed - self::DAYS_BEFORE;
$days = $this->avg_days_passed - $this->currentCount();
return $days == self::DAYS_BEFORE || $days == 0;
}

public function isCloseToLastDuration() {
return $this->currentCount() >= $this->previous_days_count - self::DAYS_BEFORE;
$days = $this->previous_days_count - $this->currentCount();
return $days == self::DAYS_BEFORE || $days == 0;
}

public static function getForNotificationType(OccurrenceNotifyTypes $type)
Expand Down

0 comments on commit abac4f8

Please sign in to comment.