From efbcaf5e3f3ddda4cb65da83e5ba7ff50ed0cb0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20=28Dibildos=29=20Gonz=C3=A1lez?= Date: Wed, 4 Feb 2026 17:18:37 +0100 Subject: [PATCH 1/4] fix(Get-Project): comment out unused SkipItems logic --- public/project/getproject.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/project/getproject.ps1 b/public/project/getproject.ps1 index 0628e0a..4458885 100644 --- a/public/project/getproject.ps1 +++ b/public/project/getproject.ps1 @@ -19,9 +19,9 @@ function Get-Project { $prj = Get-ProjectFromDatabase -Owner $Owner -ProjectNumber $ProjectNumber - if($SkipItems){ - $prj.Items = @() - } + # if($SkipItems){ + # $prj.items = @() + # } return $prj } Export-ModuleMember -Function Get-Project From 48a4b5d6f7a3b3ae84bb35f835909ff722062381 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20=28Dibildos=29=20Gonz=C3=A1lez?= Date: Wed, 4 Feb 2026 17:30:13 +0100 Subject: [PATCH 2/4] fix(Update-ProjectDatabase): handle existing items when skipping updates --- private/projectDatabase/project_database_update.ps1 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/private/projectDatabase/project_database_update.ps1 b/private/projectDatabase/project_database_update.ps1 index f492643..45241b1 100644 --- a/private/projectDatabase/project_database_update.ps1 +++ b/private/projectDatabase/project_database_update.ps1 @@ -98,6 +98,16 @@ function Update-ProjectDatabase { $items = $actualItems } + # If we are Skiping items on the update we need to keep the existing items in the database and just update the fields + if($SkipItems){ + $actualprj = Get-ProjectFromDatabase -Owner $Owner -ProjectNumber $ProjectNumber + + # Check if project has no items or the project is not cached yet + $actualItems = $actualprj.items ?? $(New-HashTable) + + $items = $actualItems + } + # Save ProjectV2 object to ProjectDatabase Save-ProjectV2toDatabase $projectV2 -Items $items -Fields $fields From 6d2961f057ae35d549ce9fb06de2f08bbd797ea9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20=28Dibildos=29=20Gonz=C3=A1lez?= Date: Wed, 4 Feb 2026 17:55:29 +0100 Subject: [PATCH 3/4] test(Get-ProjectFields): add test for Get-ProjectFields with -Force option --- Test/public/project_fields_list.test.ps1 | 30 ++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/Test/public/project_fields_list.test.ps1 b/Test/public/project_fields_list.test.ps1 index 1b339fe..b504425 100644 --- a/Test/public/project_fields_list.test.ps1 +++ b/Test/public/project_fields_list.test.ps1 @@ -78,4 +78,34 @@ function Test_GetProjectFields_SUCCESS_MoreInfo{ Assert-Contains -Presented $result[0].MoreInfo -Expected "Todo" Assert-Contains -Presented $result[0].MoreInfo -Expected "In Progress" Assert-Contains -Presented $result[0].MoreInfo -Expected "Done" +} + +# Check that when calling Get-ProjectFields with -Force the Items are still there +function Test_GetProjectFields_SUCCESS_ForceWithItems{ + + $p = Get-Mock_Project_700 ; $owner = $p.Owner ; $projectNumber = $p.Number + + # Cache project and reset Mocks + MockCall_GetProject $p -Cache + Reset_Test_Mock -NoResetDatabase + + ## Assert that items are cached + $result = Get-Project -Owner $owner -ProjectNumber $projectNumber + Assert-Count -Expected $p.items.totalCount -Presented $result.items + + # Mock the call with SkipItems + MockCall_GetProject $p -SkipItems + + # Act + $result = Get-ProjectFields -Owner $owner -ProjectNumber $projectNumber -Force + + # Assert return items. + Assert-Count -Expected $p.fields.totalCount -Presented $result + + # Check that items are still there + # As we do not set a mock it will + $result = Get-Project -Owner $owner -ProjectNumber $projectNumber + Assert-Count -Expected $p.items.totalCount -Presented $result.items + Assert-Count -Expected $p.fields.totalCount -Presented $result.fields + } \ No newline at end of file From bae9df9f8199843d9c487d4c705c3c1ba6ec7694 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20=28Dibildos=29=20Gonz=C3=A1lez?= Date: Wed, 4 Feb 2026 18:43:25 +0100 Subject: [PATCH 4/4] fix(Test_GetProjectFields_SUCCESS_ForceWithItems): correct comment formatting for clarity --- Test/public/project_fields_list.test.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Test/public/project_fields_list.test.ps1 b/Test/public/project_fields_list.test.ps1 index b504425..6865455 100644 --- a/Test/public/project_fields_list.test.ps1 +++ b/Test/public/project_fields_list.test.ps1 @@ -103,7 +103,7 @@ function Test_GetProjectFields_SUCCESS_ForceWithItems{ Assert-Count -Expected $p.fields.totalCount -Presented $result # Check that items are still there - # As we do not set a mock it will + # As we do not set a mock it will $result = Get-Project -Owner $owner -ProjectNumber $projectNumber Assert-Count -Expected $p.items.totalCount -Presented $result.items Assert-Count -Expected $p.fields.totalCount -Presented $result.fields