diff --git a/shifts.ps1 b/shifts.ps1 index 77f006f..e9c3e17 100644 --- a/shifts.ps1 +++ b/shifts.ps1 @@ -56,7 +56,7 @@ function Set-Shift { } if($script:noplan -eq $false) { - $newShift = New-MgTeamScheduleShift -TeamId $teamID -BodyParameter $params -Headers @{ "MS-APP-ACTS-AS" = $userIdAdmin } + $newshift = New-MgTeamScheduleShift -TeamId $teamID -BodyParameter $params -Headers @{ "MS-APP-ACTS-AS" = $userIdAdmin } Write-Debug("{0} {1}: setting {2}'s shift - {3} {4}-{5}" -f $dayDate.Date, $dayDate.DayOfWeek, $mail, $shiftName, $StartDate, $EndDate) } else { @@ -65,7 +65,7 @@ function Set-Shift { } - return $newShift + return $newshift } function Remove-Shift { @@ -166,7 +166,7 @@ $schedule = Get-Content -Path "./config.json" -Raw | ConvertFrom-Json # ---| ALL MEMBERS SPECIFIED IN THE SCHEDULE |--- $allemails = $schedule.PSObject.Properties | ForEach-Object { - if ($_.Name -in @("monday", "tuesday", "wednesday", "thursday", "friday")) { + if ($_.Name -in @("Monday", "Tuesday", "Wednesday", "Thursday", "Friday")) { $_.Value.PSObject.Properties | ForEach-Object { if ($_.Name -in @("ds", "ho", "os", "ns")) { if ($_.Name -eq "os") { @@ -364,7 +364,7 @@ try { # ---| OFFICE DAY SHIFT |--- else { $newshift = Set-Shift -userId $userId -groupID $group.id -shiftName "Office - Denní směna" -StartDate $dateStart -EndDate $dateEnd -color "purple" -teamID $team.id -mail $email - $allshifts += [Object[]] $newShift + $allshifts += [Object[]] $newshift $ds_shift_inplace = $true continue } @@ -411,7 +411,7 @@ try { # ---| OFFICE DAY SHIFT |--- else { $newshift = Set-Shift -userId $futureds_id -groupID $group.id -shiftName "Office - Denní směna" -StartDate $dateStart -EndDate $dateEnd -color "purple" -teamID $team.id -mail $futureds_email - $allshifts += [Object[]] $newShift + $allshifts += [Object[]] $newshift $ds_shift_inplace = $true break } @@ -435,7 +435,7 @@ try { # ---| OFFICE DAY SHIFT |--- else { $newshift = Set-Shift -userId $futureds_id -groupID $group.id -shiftName "Office - Denní směna" -StartDate $dateStart -EndDate $dateEnd -color "purple" -teamID $team.id -mail $futureds_email - $allshifts += [Object[]] $newShift + $allshifts += [Object[]] $newshift $ds_shift_inplace = $true break } @@ -489,7 +489,7 @@ try { if (Invoke-HasShift -UID $userId -shifts $rlcz_shifts -mail $email) { if((Invoke-HasShiftorTimeOff -UID $userId -shifts $shifts_today -timeoff $timeoff_today -mail $email) -eq $false) { if($email -in $ho_emails) { - $newshift = Set-Shift -userId $userId -groupID $group.id -shiftName "Home office" -StartDate $dateStart -EndDate $dateEnd.AddHours($rlcz_shift_reduction) -color "pink" -teamID $team.id -mail $email + $newshift = Set-Shift -userId $userId -groupID $group.id -shiftName "Home Office" -StartDate $dateStart -EndDate $dateEnd.AddHours($rlcz_shift_reduction) -color "pink" -teamID $team.id -mail $email $allshifts += [Object[]] $newshift continue } @@ -506,7 +506,7 @@ try { # ---| HOME-OFFICE CHECK |--- if($email -in $ho_emails) { if((Invoke-HasShiftorTimeOff -UID $userId -shifts $shifts_today -timeoff $timeoff_today -mail $email) -eq $false) { - $newshift = Set-Shift -userId $userId -groupID $group.id -shiftName "Home office" -StartDate $dateStart -EndDate $dateEnd -color "pink" -teamID $team.id -mail $email + $newshift = Set-Shift -userId $userId -groupID $group.id -shiftName "Home Office" -StartDate $dateStart -EndDate $dateEnd -color "pink" -teamID $team.id -mail $email $allshifts += [Object[]] $newshift continue }