Skip to content

Commit

Permalink
Merge pull request #150 from eperezf/release/v0.6.0
Browse files Browse the repository at this point in the history
#143 Fix division por 0
  • Loading branch information
izentenosmith authored Jan 18, 2020
2 parents 5949049 + 44a3090 commit 4c47999
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions web/app/Http/Controllers/GraficasController.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,13 @@ public function getEstadisticasEmpresas()
$empresasValidadasCount = $empresasValidadas->count();
$empresasNoValidadasCount = $empresasNoValidadas->count();
$empresasTotal = $empresasValidadasCount + $empresasNoValidadasCount;
$empresasPorcentajeValidadas = round($empresasValidadasCount / $empresasTotal * 100, 2);
$empresasPorcentajeNoValidadas = round($empresasNoValidadasCount / $empresasTotal * 100, 2);
if ($empresasTotal == 0) {
$empresasPorcentajeValidadas = 0;
$empresasPorcentajeNoValidadas = 0;
} else {
$empresasPorcentajeValidadas = round($empresasValidadasCount / $empresasTotal * 100, 2);
$empresasPorcentajeNoValidadas = round($empresasNoValidadasCount / $empresasTotal * 100, 2);
}


$estadisticasEmpresas = array(
Expand Down Expand Up @@ -290,7 +295,11 @@ public function isPasantiaTerminada($pasantia)
{
$horasSemanales = $pasantia->horasSemanales;
$totalHoras = 810;
$totalSemanas = round($totalHoras / $horasSemanales);
if ($horasSemanales == 0) {
return false;
} else {
$totalSemanas = round($totalHoras / $horasSemanales);
}
$fechaTermino = Carbon::parse($pasantia->fechaInicio);
$fechaTermino->addWeeks($totalSemanas);
if (Carbon::now() > $fechaTermino) {
Expand Down

0 comments on commit 4c47999

Please sign in to comment.