Fix limit error.
This commit is contained in:
parent
c5a96e8917
commit
e3ab735f43
|
@ -159,6 +159,8 @@ class SiteFeedAnnc
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.get_feed_cache(channel_key,merge_with_category=nil,site_source=nil,locale=I18n.locale.to_s,is_widget=false,max_len=nil)
|
def self.get_feed_cache(channel_key,merge_with_category=nil,site_source=nil,locale=I18n.locale.to_s,is_widget=false,max_len=nil)
|
||||||
|
max_len = ((max_len.to_i < 0 rescue true) ? 0 : max_len.to_i)
|
||||||
|
if max_len > 0
|
||||||
match_cond = {"channel_key"=>channel_key}
|
match_cond = {"channel_key"=>channel_key}
|
||||||
if !merge_with_category.blank? && merge_with_category.exclude?('all')
|
if !merge_with_category.blank? && merge_with_category.exclude?('all')
|
||||||
match_cond["merge_with_category"] = {"$in"=>merge_with_category}
|
match_cond["merge_with_category"] = {"$in"=>merge_with_category}
|
||||||
|
@ -177,7 +179,6 @@ class SiteFeedAnnc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
max_len = 0 if (max_len.to_i < 0 rescue true)
|
|
||||||
if max_len
|
if max_len
|
||||||
pipeline << {"$limit"=> max_len}
|
pipeline << {"$limit"=> max_len}
|
||||||
end
|
end
|
||||||
|
@ -192,6 +193,9 @@ class SiteFeedAnnc
|
||||||
end
|
end
|
||||||
tmp
|
tmp
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
[]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def all_contents_for_feed(site_source=nil,locale=I18n.locale.to_s,is_widget=false)
|
def all_contents_for_feed(site_source=nil,locale=I18n.locale.to_s,is_widget=false)
|
||||||
|
|
Loading…
Reference in New Issue