Skip to content

Commit d173b92

Browse files
committed
- if left less that 0 left = 0
1 parent d947d8a commit d173b92

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

store/articles.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ func (art *ArticlesCollection) Read(query bson.M, fields bson.M, skip int, limit
6868
return
6969
}
7070
left = total - (skip + count)
71+
if left < 0 {
72+
left = 0
73+
}
7174
return result, total, left, nil
7275
}
7376

@@ -189,6 +192,9 @@ func (art *ArticlesCollection) Search(q bson.M, skip int, limit int) (result []A
189192
return
190193
}
191194
left = total - (skip + count)
195+
if left < 0 {
196+
left = 0
197+
}
192198
if err != nil {
193199
return
194200
}

0 commit comments

Comments
 (0)