@@ -139,14 +139,14 @@ function Invoke-Query($fields, $wiql, $output = $true)
139139 return $workItems
140140}
141141
142- function BuildHashKeyNoNull ()
142+ function BuildHashKeyFromNonNullArgs ()
143143{
144144 $filterNulls = $args | Where-Object { $_ }
145- # if we had any nulls then return null
146- if (! $filterNulls -or $args .Count -ne $filterNulls .Count ) {
145+ # if we had any non- nulls then return it
146+ if (! $filterNulls ) {
147147 return $null
148148 }
149- return BuildHashKey $args
149+ return BuildHashKey @filterNulls
150150}
151151
152152function BuildHashKey ()
@@ -241,11 +241,7 @@ function FindLatestPackageWorkItem($lang, $packageName, $groupId = $null, $outpu
241241
242242function FindPackageWorkItem ($lang , $packageName , $version , $groupId = $null , $outputCommand = $true , $includeClosed = $false , $ignoreReleasePlannerTests = $true , $tag = $null )
243243{
244- $keyArgs = @ ($lang , $packageName , $version )
245- if (! [string ]::IsNullOrWhiteSpace($groupId )) {
246- $keyArgs += $groupId
247- }
248- $key = BuildHashKeyNoNull @keyArgs
244+ $key = BuildHashKeyFromNonNullArgs $lang $packageName $version $groupId
249245 if ($key -and $packageWorkItems.ContainsKey ($key )) {
250246 return $packageWorkItems [$key ]
251247 }
@@ -304,11 +300,7 @@ function FindPackageWorkItem($lang, $packageName, $version, $groupId = $null, $o
304300
305301 foreach ($wi in $workItems )
306302 {
307- $localKeyArgs = @ ($wi.fields [" Custom.Language" ], $wi.fields [" Custom.Package" ], $wi.fields [" Custom.PackageVersionMajorMinor" ])
308- if (! [string ]::IsNullOrWhiteSpace($wi.fields [" Custom.GroupId" ])) {
309- $localKeyArgs += $wi.fields [" Custom.GroupId" ]
310- }
311- $localKey = BuildHashKeyNoNull @localKeyArgs
303+ $localKey = BuildHashKeyFromNonNullArgs $wi.fields [" Custom.Language" ] $wi.fields [" Custom.Package" ] $wi.fields [" Custom.PackageVersionMajorMinor" ] $wi.fields [" Custom.GroupId" ]
312304 if (! $localKey ) {
313305 $packageWorkItemWithoutKeyFields [$wi.id ] = $wi
314306 Write-Host " Skipping package [$ ( $wi.id ) ]$ ( $wi.fields [' System.Title' ]) which is missing required fields language, package, or version."
0 commit comments