Fix sorting in planet feeds

Problem: Random order for posts with identical timestamp
This commit is contained in:
Stefan Schlott 2014-12-12 16:52:18 +01:00
parent ab34efe863
commit f18f3cd60b

View file

@ -50,7 +50,13 @@ feeds.each do |feed,data|
end
# Sort, limit list
blogposts['blogposts'].sort! { |a,b| b['date'] <=> a['date'] }
blogposts['blogposts'].sort! do |a,b|
if (b['date'] <=> a['date'])==0
b['url'] <=> a['url']
else
b['date'] <=> a['date']
end
end
blogposts['blogposts'] = blogposts['blogposts'][0..19]
# Output