From d173b92f493476d810c5cc37fbdd53292397a801 Mon Sep 17 00:00:00 2001 From: vanya andreychuk Date: Thu, 1 Dec 2016 14:21:17 +0200 Subject: [PATCH] - if left less that 0 left = 0 --- store/articles.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/store/articles.go b/store/articles.go index b610c6b..fd881c4 100644 --- a/store/articles.go +++ b/store/articles.go @@ -68,6 +68,9 @@ func (art *ArticlesCollection) Read(query bson.M, fields bson.M, skip int, limit return } left = total - (skip + count) + if left < 0 { + left = 0 + } return result, total, left, nil } @@ -189,6 +192,9 @@ func (art *ArticlesCollection) Search(q bson.M, skip int, limit int) (result []A return } left = total - (skip + count) + if left < 0 { + left = 0 + } if err != nil { return }