Monorepo for Tangled tangled.org

appview: improve pagination.Page usage #519

closed opened by ptr.pet targeting master from [deleted fork]: pipeline-paginated
Labels

None yet.

assignee

None yet.

Participants 2
AT URI
at://did:plc:dfl62fgb7wtjj3fcbb72naae/sh.tangled.repo.pull/3lwubheua2u22
+2 -2
Interdiff #2 โ†’ #3
appview/db/issues.go

This file has not been changed.

appview/db/notifications.go

This file has not been changed.

appview/issues/issues.go

This file has not been changed.

appview/issues/router.go

This file has not been changed.

appview/middleware/middleware.go

This file has not been changed.

appview/notifications/notifications.go

This file has not been changed.

appview/pages/pages.go

This file has not been changed.

appview/pages/templates/goodfirstissues/index.html

This file has not been changed.

appview/pages/templates/notifications/list.html

This file has not been changed.

appview/pages/templates/repo/issues/issues.html

This file has not been changed.

appview/pagination/page.go

This file has not been changed.

appview/repo/feed.go

This file has not been changed.

+2 -2
appview/state/gfi.go
··· 62 62 return 63 63 } 64 64 65 - pagination := pagination.NewFromPage(page, len(allIssues)) 66 - 67 65 var goodFirstIssues []models.Issue 68 66 for _, issue := range allIssues { 69 67 if issue.Labels.ContainsLabel(goodFirstIssueLabel) { ··· 101 99 return sortedGroups[i].Repo.Name < sortedGroups[j].Repo.Name 102 100 }) 103 101 102 + pagination := pagination.NewFromPage(page, len(sortedGroups)) 103 + 104 104 groupStart := page.Count * page.No 105 105 groupEnd := page.Count * (page.No + 1) 106 106 if groupStart > len(sortedGroups) {

History

4 rounds 2 comments
sign up or login to add to the discussion
1 commit
expand
eda039f3
appview: improve pagination API
expand 0 comments
closed without merging
1 commit
expand
93bdc6bc
appview: improve pagination API
expand 0 comments
1 commit
expand
1af31ddd
appview: improve pagination API
expand 1 comment

i went with a page number api and made pagination produce pages instead, i think it fits it better (pagination still uses offset / limit / total though ofc)

ptr.pet submitted #0
1 commit
expand
8ee73a8a
appview: improve pagination.Page usage
expand 1 comment

this helper is quite strange. can we use a slightly better API? the page size does not belong in the FirstPage method (although i understand it was previously hardcoded here).

we can do something like p := NewPagination(WithSize(N), WithOffset(0), WithTotal(...)) and have p.FirstPage() perhaps.