Fix "You Ran out of Credits - hours"

This commit is contained in:
WBLKLeipe 2021-11-08 07:38:29 +01:00
parent 3fac4f87c0
commit 14bceeb311

View file

@ -48,6 +48,30 @@ class HomeController extends Controller
}
}
/**
* @description Set "hours", "days" or nothing behind the remaining time
*
* @param float $days
* @param float $hours
*
* @return string
*/
public function getTimeLeftBoxUnit(float $days, float $hours)
{
if ($days < 1)
{
if ($hours < 1)
{
return;
}
else
{
return "hours";
}
}
return "days";
}
/**
* @description Get the Text for the Days-Left-Box in HomeView
*
@ -89,7 +113,7 @@ class HomeController extends Controller
$bg = $this->getTimeLeftBoxBackground($days);
$boxText = $this->getTimeLeftBoxText($days, $hours);
$unit = $days < 1 ? 'hours' : 'days';
$unit = $this->getTimeLeftBoxUnit($days, $hours);
}