Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix holidays calculations #748

Merged
merged 1 commit into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions model/facade/action/GetHolidayHoursBaseAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,13 @@ protected function getHoursSummary(DateTime $referenceDate = NULL): array
//if the reference data is in the future, then usedHours has to be 0 - we are not time travelers
if($referenceDate > new DateTime()){
$userUsedHours[$userVO->getLogin()] = 0;
$userScheduledHours[$userVO->getLogin()] = $vacations;
}
else {
//need to do this because we need to get hours for interval
$userUsedHours[$userVO->getLogin()] = $taskDao->getVacations($userVO, $reportInit, $referenceDate)["add_hours"] ?? 0;
$userScheduledHours[$userVO->getLogin()] = $vacations - $userUsedHours[$userVO->getLogin()];
}

$userScheduledHours[$userVO->getLogin()] = $vacations - $userUsedHours[$userVO->getLogin()];

// The difference is the number of pending holiday hours
$userPendingHolidayHours[$userVO->getLogin()] = $holidayHours - $vacations;
}
Expand Down
2 changes: 1 addition & 1 deletion model/facade/action/GetHolidaySummaryReportAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ protected function doExecute()
'availableHours' => round($summary['availableHours'][$this->user->getLogin()], 2),
'usedHours' => round($usedHours, 2),
'pendingHours' => round($summary['pendingHours'][$this->user->getLogin()], 2),
'plannedHours' => round($summary['usedHours'][$this->user->getLogin()], 2),
'scheduledHours' => round($summary['scheduledHours'][$this->user->getLogin()] - $usedHours, 2),
'percentage' => $summary['availableHours'][$this->user->getLogin()] ? round(($summary['usedHours'][$this->user->getLogin()] / $summary['availableHours'][$this->user->getLogin()]) * 100, 2) : 0,
'hoursDay' => $validJourney,
'holidays' => $leaves,
Expand Down
2 changes: 1 addition & 1 deletion web/holidaySummary.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
<td>{{ row.hoursDay }}</td>
<td>{{ row.availableHours }}</td>
<td>{{ row.usedHours }}</td>
<td>{{ row.plannedHours }}</td>
<td>{{ row.scheduledHours }}</td>
<td>{{ row.pendingHours }}</td>
<td :class="{ 'alert': row.percentage < 50}">{{row.percentage}}</td>
<td v-for="(userWeek, index) in row.holidays" :key="row.user + '-' + index" :class="{ 'highlight': userWeek > 0}">{{userWeek}}</td>
Expand Down
2 changes: 1 addition & 1 deletion web/services/getHolidaySummary.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
$line["hoursDay"],
$line["availableHours"],
$line["usedHours"],
$line["plannedHours"],
$line["scheduledHours"],
$line["pendingHours"],
$line["percentage"]
),
Expand Down