mirror of
https://git.sr.ht/~phw/scotty
synced 2025-04-30 05:37:05 +02:00
Added util.Min and util.Max helpers
This commit is contained in:
parent
be1cfdac9e
commit
c4da3a40cc
4 changed files with 73 additions and 12 deletions
|
@ -26,6 +26,7 @@ import (
|
|||
"go.uploadedlobster.com/scotty/internal/config"
|
||||
"go.uploadedlobster.com/scotty/internal/i18n"
|
||||
"go.uploadedlobster.com/scotty/internal/models"
|
||||
"go.uploadedlobster.com/scotty/internal/util"
|
||||
"golang.org/x/oauth2"
|
||||
)
|
||||
|
||||
|
@ -105,10 +106,7 @@ out:
|
|||
// and continue.
|
||||
if offset >= result.Total {
|
||||
p.Total = int64(result.Total)
|
||||
offset = result.Total - perPage
|
||||
if offset < 0 {
|
||||
offset = 0
|
||||
}
|
||||
offset = util.Max(result.Total-perPage, 0)
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -177,10 +175,7 @@ out:
|
|||
if offset >= result.Total {
|
||||
p.Total = int64(result.Total)
|
||||
totalCount = result.Total
|
||||
offset = result.Total - perPage
|
||||
if offset < 0 {
|
||||
offset = 0
|
||||
}
|
||||
offset = util.Max(result.Total-perPage, 0)
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue