diff options
author | FChannel <=> | 2021-01-30 01:47:26 -0800 |
---|---|---|
committer | FChannel <=> | 2021-01-30 01:47:26 -0800 |
commit | f0afe325423011a8cb4eed5192375fcae5312da3 (patch) | |
tree | 7baf99ca88d29de781c576ab55623650594bea2d /client.go | |
parent | 2fdaf020b1d952a9c86863c380affceb9ac09c61 (diff) |
fix for pagnation
Diffstat (limited to 'client.go')
-rw-r--r-- | client.go | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -7,7 +7,6 @@ import "database/sql" import _ "github.com/lib/pq" import "strings" import "strconv" -import "math" import "sort" import "regexp" import "io/ioutil" @@ -183,7 +182,7 @@ func OutboxGet(w http.ResponseWriter, r *http.Request, db *sql.DB, collection Co var orderedReplies []ObjectBase for i := 0; i < 5; i++ { cur := len(replies) - i - 1 - if cur > -1 { + if cur > - 1 { orderedReplies = append(orderedReplies, replies[cur]) } } @@ -199,8 +198,8 @@ func OutboxGet(w http.ResponseWriter, r *http.Request, db *sql.DB, collection Co } var pages []int - pageLimit := math.Round(float64(len(mergeCollection.OrderedItems) / offset)) - for i := 0.0; i <= pageLimit; i++ { + pageLimit := (float64(len(mergeCollection.OrderedItems)) / float64(offset)) + for i := 0.0; i < pageLimit; i++ { pages = append(pages, int(i)) } |