Skip to content

Conversation

jannaahs
Copy link

@jannaahs jannaahs commented Jul 6, 2021

The finalPage was calculated incorrectly in the repo-search component. This caused an empty unnecessary page to be added as described in #15601.

OLD

this.finalPage = Math.floor(count / this.searchLimit) + 1;

This calculation will round down the number of pages and increment.

Math.floor(31/15) + 1 = 3
Math.floor(30/15) + 1 = 3
Math.floor(29/15) + 1 = 2

NEW

this.finalPage = Math.ceil(count / this.searchLimit);

This calculation will always round up the number of pages, if it's not an integer

Math.ceil(31/15) = 3
Math.ceil(30/15) = 2
Math.ceil(29/15) = 2

This pull request will fix #15601.

@6543 6543 added this to the 1.15.0 milestone Jul 7, 2021
@6543 6543 added type/bug topic/ui Change the appearance of the Gitea UI labels Jul 7, 2021
@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Jul 7, 2021
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jul 8, 2021
@6543 6543 force-pushed the fix/too-many-pages-on-repo-paging-in-dashboard branch from 19b0f34 to f03779f Compare July 9, 2021 03:10
@6543
Copy link
Member

6543 commented Jul 9, 2021

rebased ... let's see if it pass now?

@6543
Copy link
Member

6543 commented Jul 9, 2021

@techknowlogick do a force merge? since same diff passed at #16382 ?

@6543 6543 closed this in #16382 Jul 13, 2021
@6543
Copy link
Member

6543 commented Jul 13, 2021

merged as 57ee06f

@jannaahs thanks for the pull & I have no idear why your's did fail all the time but unrelated to the patch!

@jannaahs jannaahs deleted the fix/too-many-pages-on-repo-paging-in-dashboard branch July 13, 2021 15:25
@go-gitea go-gitea locked and limited conversation to collaborators Oct 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. topic/ui Change the appearance of the Gitea UI type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Repo paging in dashboard shows too many pages with 30 repos
8 participants