disabled rlcz maintenance planner
This commit is contained in:
42
shifts.ps1
42
shifts.ps1
@@ -200,7 +200,7 @@ $endSpanDate = Get-Date -Day $startSpanDate.AddDays($daysahead).Day -Month $star
|
||||
|
||||
$rlcz_mtnc_email = "jiri.kotlan@itego.cz"
|
||||
$rlcz_shift_reduction = -3 #How many hours does the next day shift get reduced by
|
||||
$rlcz_maintenance_length = 4
|
||||
#$rlcz_maintenance_length = 4
|
||||
|
||||
# --------------------------- | MAIN SCRIPT | ---------------------------
|
||||
|
||||
@@ -325,27 +325,27 @@ try {
|
||||
}
|
||||
|
||||
# ---| RLCZ MAINTENANCE PLANNER |---
|
||||
if($dayDate.DayOfWeek -eq 'Wednesday') {
|
||||
if($email -eq $rlcz_mtnc_email) {
|
||||
$tuesdaynumber = (1..$dayDate.Day | ForEach-Object {
|
||||
(Get-Date -Year $dayDate.Year -Month $dayDate.Month -Day $_).DayOfWeek
|
||||
} | Where-Object { $_ -eq 'Tuesday' }).Count
|
||||
#if($dayDate.DayOfWeek -eq 'Wednesday') {
|
||||
# if($email -eq $rlcz_mtnc_email) {
|
||||
# $tuesdaynumber = (1..$dayDate.Day | ForEach-Object {
|
||||
# (Get-Date -Year $dayDate.Year -Month $dayDate.Month -Day $_).DayOfWeek
|
||||
# } | Where-Object { $_ -eq 'Tuesday' }).Count
|
||||
|
||||
if($tuesdaynumber -ge 2 -and $tuesdaynumber -le 4) {
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
# if($tuesdaynumber -ge 2 -and $tuesdaynumber -le 4) {
|
||||
# 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