Azure-DevOps icon indicating copy to clipboard operation
Azure-DevOps copied to clipboard

Adding support for full weeks

Open MaximRouiller opened this issue 3 years ago • 4 comments

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 avatar Jul 15 '22 16:07 MaximRouiller

@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!

vinijmoura avatar Jul 15 '22 18:07 vinijmoura

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 }

vinijmoura avatar Jul 15 '22 18:07 vinijmoura

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(?)

MaximRouiller avatar Jul 15 '22 19:07 MaximRouiller

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!

vinijmoura avatar Jul 16 '22 03:07 vinijmoura