fixed RLCZ maintenance shift being planned multiple times
This commit is contained in:
@@ -335,11 +335,17 @@ try {
|
||||
Write-Debug("{0} {1}: yesterday was Tuesday number {3}, planning RLCZ maintenance shift" -f $dayDate.Date, $dayDate.DayOfWeek, $email, $tuesdaynumber)
|
||||
$rlcz_starttime = $dateEnd.AddHours(1)
|
||||
$rlcz_endtime = $rlcz_starttime.AddHours($rlcz_maintenance_length)
|
||||
$rlcz_shifts = [Object[]] $allshifts | Where-Object -Filter { $_.schedulingGroupId -eq $group.Id -and $_.SharedShift.Notes -eq "RLCZ" -and ($_.SharedShift.StartDateTime.ToString("yyyy-MM-dd HH:mm") -eq $rlcz_starttime.ToString("yyyy-MM-dd HH:mm") -and $_.SharedShift.EndDateTime.ToString("yyyy-MM-dd HH:mm") -eq $rlcz_endtime.ToString("yyyy-MM-dd HH:mm")) }
|
||||
if(Invoke-HasShift -UID $userId -shifts $rlcz_shifts -mail $email) {
|
||||
Write-Debug("{0} {1}: RLCZ maintenance shift is already set for {2}" -f $dayDate.Date, $dayDate.DayOfWeek, $email)
|
||||
}
|
||||
else {
|
||||
$newshift = Set-Shift -userId $userId -groupID $group.id -shiftName "RLCZ" -StartDate $rlcz_starttime -EndDate $rlcz_endtime -color "yellow" -teamID $team.id -mail $email
|
||||
$allshifts += [Object[]] $newshift
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ---| DAY SHIFT CHECK |---
|
||||
if($ds_shift_inplace -eq $false) {
|
||||
|
||||
Reference in New Issue
Block a user