Skip to content

[FIX] Results pagination on /directory REST endpoint#11551

Merged
sampaiodiego merged 8 commits intodevelopfrom
fix-rest-directory-pagination
Aug 20, 2018
Merged

[FIX] Results pagination on /directory REST endpoint#11551
sampaiodiego merged 8 commits intodevelopfrom
fix-rest-directory-pagination

Conversation

@MarcosSpessatto
Copy link
Copy Markdown
Contributor

Closes #11151

@MarcosSpessatto MarcosSpessatto added this to the 0.68.0 milestone Jul 23, 2018
@MarcosSpessatto MarcosSpessatto self-assigned this Jul 23, 2018
@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-11551 July 23, 2018 14:47 Inactive
@theorenck theorenck modified the milestones: 0.68.0, Short-term Jul 31, 2018
@MarcosSpessatto MarcosSpessatto modified the milestones: Short-term, 0.69.0 Aug 7, 2018
Marcos Defendi added 2 commits August 17, 2018 15:41
@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-11551 August 17, 2018 18:47 Inactive
}
const sortBy = sort ? Object.keys(sort)[0] : undefined;
const sortDirection = sort && Object.values(sort)[0] === 1 ? 'asc' : 'desc';
const page = offset <= 0 ? 0 : Math.ceil(offset / count);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the correct is to use Math.floor, using ceil page will never be 0.

also count should be tested to be greater than 0

Marcos Defendi added 2 commits August 20, 2018 12:51
Fix wrong page calculus in REST directory
@engelgabriel engelgabriel temporarily deployed to rocket-chat-pr-11551 August 20, 2018 15:53 Inactive
rodrigok
rodrigok previously approved these changes Aug 20, 2018
@sampaiodiego sampaiodiego temporarily deployed to rocket-chat-pr-11551 August 20, 2018 20:16 Inactive
fix empty results when page or offset are equal zero
@sampaiodiego sampaiodiego changed the title [FIX] Fix pagination on REST /directory [FIX] Results pagination on /directory REST endpoint Aug 20, 2018
@sampaiodiego sampaiodiego merged commit ab21be6 into develop Aug 20, 2018
@sampaiodiego sampaiodiego deleted the fix-rest-directory-pagination branch August 20, 2018 23:14
@sampaiodiego sampaiodiego mentioned this pull request Aug 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants