Adding support for full weeks
Ensuring that StartDate is a Sunday but that the selected StartDate is also encompassed within the new StartDate.
This ensures that we support full weeks.
@MaximRouiller IF my week begins on Sunday, I need to add 12 days (not more 11 days) to get Next Friday. Do you fix this problem, please? or 13 days, if you get Saturday too!
Code sugestion (parameter $IncludeWeekends) - bold mark
Param ( [string]$PAT, [string]$Organization, [string]$Project, [string]$TeamName, [DateTime]$StartDate, [int]$NumberOfSprints, [bool]$IncludeWeekends )
echo $PAT | az devops login --org $Organization
Write-Host '===Configuring connection to organization and Team Project' az devops configure --defaults organization=$Organization project=$Project
$addDays=11
if ($IncludeWeekends -eq $true) { ** $StartDate=$StartDate.AddDays(0 - $StartDate.DayOfWeek.value__);** ** $addDays=13** }
For ($i=1; $i -le $NumberOfSprints; $i++) { $Sprint = 'Sprint ' + $i $StartDateIteration = $StartDate.AddDays(($i - 1) * 14) $FinishDateIteration = $StartDateIteration.AddDays($addDays) $createIteration = az boards iteration project create --name $Sprint --start-date $StartDateIteration --finish-date $FinishDateIteration --org $Organization --project $Project | ConvertFrom-Json $addIteration = az boards iteration team add --id $createIteration.Identifier --team $TeamName --org $Organization --project $Project | ConvertFrom-Json Write-Host $addIteration.name 'created on path'$addIteration.path }
I was going with 14 days periods but you could basically create a strategy pattern where the user can select the date creation mode.
- Full week (Sunday, weekdays, Saturday)
- Weekday only (Monday to Friday)
- Other(?)
I was going with 14 days periods but you could basically create a strategy pattern where the user can select the date creation mode.
- Full week (Sunday, weekdays, Saturday)
- Weekday only (Monday to Friday)
- Other(?)
I'll think about these options!