Fix sorting in planet feeds
Problem: Random order for posts with identical timestamp
This commit is contained in:
parent
ab34efe863
commit
f18f3cd60b
1 changed files with 7 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue