Return the value of paginator.TotalPages in SetTotalPages...

when the given number of items is below 1.
This commit is contained in:
Nicolas Martin 2020-10-28 12:11:12 +01:00 committed by Christian Rocha
parent 97020cd0d2
commit 7d1c04164e

View File

@ -40,8 +40,8 @@ type Model struct {
// used for other things beyond navigating sets. Note that it both returns the
// number of total pages and alters the model.
func (m *Model) SetTotalPages(items int) int {
if items == 0 {
return 0
if items < 1 {
return m.TotalPages
}
n := items / m.PerPage
if items%m.PerPage > 0 {