Prevent division by zero if show lengths end up being zero

This commit is contained in:
Albert Santoni 2013-12-13 16:10:36 -05:00
parent 1577b7c41e
commit fa0a190277
2 changed files with 12 additions and 5 deletions

View file

@ -550,9 +550,12 @@ SQL;
{
$durationSeconds = $this->getDurationSecs();
$timeSeconds = $this->getTimeScheduledSecs();
$percent = ceil(($timeSeconds / $durationSeconds) * 100);
if ($durationSeconds != 0) { //Prevent division by zero if the show duration is somehow zero.
$percent = ceil(($timeSeconds / $durationSeconds) * 100);
} else {
$percent = 0;
}
return $percent;
}