Skip to content

Commit

Permalink
Merge pull request #981 from portabilis/portabilis-patch-2024-12-03
Browse files Browse the repository at this point in the history
Portabilis patch 03/12/2024
  • Loading branch information
edersoares authored Dec 3, 2024
2 parents 4d466c3 + 9a5b247 commit 412e6bb
Show file tree
Hide file tree
Showing 5 changed files with 330 additions and 311 deletions.
21 changes: 10 additions & 11 deletions app/Services/Reports/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,25 @@ public static function sumTimes(array|Collection|null $times): string

public static function formatWorkload(?float $workload): string
{
if ($workload) {
$hour = (int) $workload;
$workload -= $hour;
$minutes = round($workload * 60);
if ($minutes < 10) {
$minutes = '0' . $minutes;
if ($workload !== null) {
$hours = (int)$workload;
$minutes = (int)round(($workload - $hours) * 60);
if ($minutes === 60) {
$hours++;
$minutes = 0;
}

if ($hour < 10) {
$hour = '0' . $hour;
}

return $hour . ':' . $minutes;
return sprintf('%02d:%02d', $hours, $minutes);
}

return '00:00';
}

public static function format(mixed $value, ?int $decimalPlaces = null): string
{
$value = str_replace(',', '.', (string) $value);
$value = bcdiv($value, '1', $decimalPlaces ?? 1);

return number_format($value, $decimalPlaces ?? 1, ',', '.');
}

Expand Down
Loading

0 comments on commit 412e6bb

Please sign in to comment.