Skip to content

Commit

Permalink
Merge branch '1337-result-complete-status' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
aashish-t-magar committed Jan 16, 2024
2 parents cba6c71 + f978f9f commit 9a0bf76
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
15 changes: 15 additions & 0 deletions app/Observers/IndicatorObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,19 @@ public function setIndicatorDefaultValues($indicator, bool $changeUpdatedAt = tr
$indicator->saveQuietly();
}
}

/**
* Handle the Indicator "deleted" event.
*
* @param Indicator $indicator
*
* @return void
* @throws \JsonException
*/
public function deleted(Indicator $indicator): void
{
$resultObserver = new ResultObserver();
$resultObserver->updateActivityElementStatus($indicator->result);
$resultObserver->resetActivityStatus($indicator->result);
}
}
15 changes: 15 additions & 0 deletions app/Observers/PeriodObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,19 @@ public function setPeriodDefaultValues($period, bool $changeUpdatedAt = true): v

$period->saveQuietly();
}

/**
* Handle the Period "deleted" event.
*
* @param Period $period
*
* @return void
* @throws \JsonException
*/
public function deleted(Period $period): void
{
$resultObserver = new ResultObserver();
$resultObserver->updateActivityElementStatus($period->indicator->result);
$resultObserver->resetActivityStatus($period->indicator->result);
}
}
14 changes: 14 additions & 0 deletions app/Observers/ResultObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,18 @@ public function setResultDefaultValues($result, bool $changeUpdatedAt = true): v
$result->saveQuietly();
}
}

/**
* Handle the Result "deleted" event.
*
* @param Result $result
*
* @return void
* @throws \JsonException
*/
public function deleted(Result $result): void
{
$this->updateActivityElementStatus($result);
$this->resetActivityStatus($result);
}
}

0 comments on commit 9a0bf76

Please sign in to comment.