Skip to content

Commit

Permalink
GH-224 Allow to get min vacation duration as a number
Browse files Browse the repository at this point in the history
  • Loading branch information
mdziekon committed Jun 24, 2022
1 parent 385d73f commit 99dfb87
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,20 @@ function getUserMinimalVacationTime(&$user) {
return getUserMinimalNormalVacationTime($user);
}

function getUserMinimalNormalVacationTime(&$user) {
$hadProAccountWhenVacationStarted = ($user['pro_time'] > $user['vacation_starttime']);
function getUserMinimalNormalVacationDuration(&$user, $atTimestamp) {
$hasProAccount = ($user['pro_time'] > $atTimestamp);

return (
$hasProAccount ?
MINURLOP_PRO :
MINURLOP_FREE
);
}

$vacationMinimalDuration = (
$hadProAccountWhenVacationStarted ?
MINURLOP_PRO :
MINURLOP_FREE
function getUserMinimalNormalVacationTime(&$user) {
$vacationMinimalDuration = getUserMinimalNormalVacationDuration(
$user,
$user['vacation_starttime']
);

return ($vacationMinimalDuration + $user['vacation_starttime']);
Expand Down

0 comments on commit 99dfb87

Please sign in to comment.