Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get-JiraGroupMember not returning all members for group size 51 #307

Closed
stevenyoungs opened this issue Aug 6, 2018 · 1 comment · Fixed by #308
Closed

Get-JiraGroupMember not returning all members for group size 51 #307

stevenyoungs opened this issue Aug 6, 2018 · 1 comment · Fixed by #308

Comments

@stevenyoungs
Copy link

Given a Jira group of exactly 51 members, Get-JiraGroupMember is only returning the first 50 users
Add one additional member to the group, bringing the number of members to 52, and all 52 members are returned.

I have not tested but I surmise that the problem occurs for groups where the number of members is n * $PageSize + 1

Expected Behavior

Get-JiraGroupMember should return all members of the group no matter how many members of the group there are.

Current Behavior

Given a valid Jira group containing exactly 51 members, Get-JiraGroupMember will only return the first 50 members.

Possible Solution

The problem manifests in Invoke-JiraMethod. The first 50 members have already been successfully processed. The JSON with the 51st member has been returned by the Jira server. The data container is expanded:
$result = $response.$container
There is only a single object. The subsequent while loop then calls .Count
} while ($result.Count)
however $result is a PSCustomObject with no Count member. Count evaluates to $null. The while loop therefore exits and the final group member is not processed

I'm not sure of the best appraoch to fixing.

Steps to Reproduce (for bugs)

Given a Jira group called "TestGroup" which has exactly 51 members and an existing server connect:
1.$groupMembers = Get-JiraGroupMember "TestGroup"
2. $groupMembers.Count

Context

Your Environment

Get-Module JiraPS -ListAvailable | select version

Version
-------
2.8.3
2.8.2
2.8.1
2.8.0
2.4.4

Get-Module JiraPS

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     2.8.3      JiraPS                              {Add-JiraFilterPermission, Add-JiraGroupMember, Add-JiraIssueAttachment, Add-JiraIssueComment...}

> $PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.17134.165
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17134.165
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
@lipkau
Copy link
Member

lipkau commented Aug 6, 2018

Oh oh... did I screw up?

can you test it with Get-JiraIssue -query ""?


Edit:
I can reproduce this.
I will fix it sometime tomorrow.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants