Skip to content

Commit

Permalink
Merge pull request #1156 from LD4P/paging_rounding
Browse files Browse the repository at this point in the history
Force rounding up for last page of paging.
  • Loading branch information
jcoyne committed Aug 2, 2019
2 parents f4cedf4 + cb97234 commit cb0d861
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/search/SearchResultsPaging.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const SearchResultsPaging = (props) => {
newCurrentPage = currentPage + 1
break
case '»':
newCurrentPage = Math.round(props.totalResults / Config.searchResultsPerPage)
newCurrentPage = Math.ceil(props.totalResults / Config.searchResultsPerPage)
break
case undefined: // this is required to capture clicks on disabled buttons
return
Expand All @@ -55,7 +55,7 @@ const SearchResultsPaging = (props) => {
props.fetchSearchResults(props.queryString, queryFrom)
}

const lastPage = () => Math.round(props.totalResults / Config.searchResultsPerPage)
const lastPage = () => Math.ceil(props.totalResults / Config.searchResultsPerPage)
const pageButton = (key, active) => <Pagination.Item key={ key } active={ active }>{key}</Pagination.Item>
const pageButtons = () => Array.from({ length: lastPage() }, (_, index) => pageButton(index + 1, index + 1 === currentPage))

Expand Down

0 comments on commit cb0d861

Please sign in to comment.