Skip to content

Commit

Permalink
fix: condition
Browse files Browse the repository at this point in the history
  • Loading branch information
adelkahomolova committed Jan 6, 2020
1 parent ab45b74 commit 770ad50
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/inspectors/CollaborationInspector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,14 @@ export class CollaborationInspector implements ICollaborationInspector {
let i = 1;

while (hasNextPage) {
const pullRequests = await this.service.getPullRequests(owner, repo, { ...options, ...{ pagination: { page: i } } });
const pullRequests = await this.service.getPullRequests(owner, repo, {
...options,
...{ pagination: { page: i, perPage: options.pagination?.perPage } },
});
//Add pull requstes to the existing array of PRs from another page
items = _.merge(items, pullRequests.items);

if (items.length >= <number>options?.maxNumberOfPullRequests) {
if (<number>options?.maxNumberOfPullRequests >= items.length) {
//Get maximum n newest pull requests
items = _.take(items, options.maxNumberOfPullRequests);
break;
Expand Down

0 comments on commit 770ad50

Please sign in to comment.