Fix pagination errors
This commit is contained in:
1 parent
df8633e35c
commit
786954e35b
1 file changed
+3
-1
@@ -374,10 +374,11 @@ class SiteFeedAnnc
|
||||
pipeline_to_get_data << {"$sort"=>sort_maps}
|
||||
end
|
||||
|
||||
if max_len > 0
|
||||
if max_len > 0 && tags.blank? && hashtags.blank?
|
||||
pipeline_to_get_data << {"$limit"=> max_len}
|
||||
end
|
||||
|
||||
|
||||
pipeline_to_get_count = pipeline.clone
|
||||
pipeline_to_get_count << {"$group" => {
|
||||
_id: nil,
|
||||
@@ -412,6 +413,7 @@ class SiteFeedAnnc
|
||||
if (tags.present? && tags != "all") || (hashtags.present? && hashtags != "all")
|
||||
feeds = feeds.uniq { |f| f['id'] }
|
||||
feeds_count = feeds.size
|
||||
feeds = feeds.first(max_len) if max_len > 0
|
||||
end
|
||||
|
||||
return feeds, feeds_count
|
||||
|
||||
Reference in new issue
Block a user