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

[www] Add paging capability to proposal list routes #136

Merged
merged 1 commit into from
Nov 20, 2017

Conversation

sndurkin
Copy link
Contributor

@sndurkin sndurkin commented Nov 13, 2017

Summary of changes:

  • Add paging capability to /vetted and /unvetted routes
  • Add v1.ProposalListPageSize
  • Add a unit test for paging
  • Update reference client to create and fetch 2 pages of proposals
  • Update API docs
  • Add some missing info for API docs

Fixes #43.

@sndurkin sndurkin force-pushed the paging branch 2 times, most recently from 6b94508 to 120c895 Compare November 13, 2017 04:38
Copy link
Member

@marcopeereboom marcopeereboom left a comment

Choose a reason for hiding this comment

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

We need to get this tested inside refclient as well.

@sndurkin sndurkin force-pushed the paging branch 2 times, most recently from 0e3ab7c to 302f345 Compare November 15, 2017 17:44
@sndurkin sndurkin changed the title [WIP] [www] Add paging capability to proposal list routes [www] Add paging capability to proposal list routes Nov 15, 2017
@sndurkin
Copy link
Contributor Author

@marcopeereboom updated refclient and API docs, it's ready for re-review.


// Iterate in reverse order because they're sorted by oldest timestamp first.
for i := len(b.inventory) - 1; i >= 0; i-- {
p := b.inventory[i]
Copy link
Contributor

Choose a reason for hiding this comment

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

  • rename p to proposal

for i := len(b.inventory) - 1; i >= 0; i-- {
p := b.inventory[i]
if _, ok := statusMap[p.Status]; ok {
if pageStarted {
Copy link
Contributor

@rgeraldes rgeraldes Nov 18, 2017

Choose a reason for hiding this comment

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

switch { in place of if-else chains (idiomatic)

Copy link
Contributor

Choose a reason for hiding this comment

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

as a result the break needs to be changed to break "TAG Before the for like this 'tag:'".

// If beforeIdx is set, the caller is asking for vetted proposals whose
// last result is before the provided proposal.
if beforeIdx >= 0 {
for i := beforeIdx + 1; i < len(b.inventory); i++ {
Copy link
Contributor

Choose a reason for hiding this comment

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

change for range b.inventory [beforeIdx + 1:]

@marcopeereboom marcopeereboom merged commit bc5acef into decred:master Nov 20, 2017
@sndurkin sndurkin deleted the paging branch November 20, 2017 16:02
vibros68 pushed a commit to vibros68/politeia that referenced this pull request Aug 17, 2021
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.

3 participants