FIX: Deleted posts were showing the wrong dates in the timeline

This commit is contained in:
Robin Ward 2016-05-26 12:49:54 -04:00
parent 9ec56775de
commit 6da097d91c
No known key found for this signature in database
GPG key ID: 0E091E2B4ED1B83D
2 changed files with 7 additions and 2 deletions

View file

@ -11,10 +11,10 @@ module TimelineLookup
tuples.each_with_index do |t, idx|
next unless (idx % every) === 0
_, post_number, days_ago = t
days_ago = t[2]
if (days_ago != last_days_ago)
result << [post_number, days_ago]
result << [idx+1, days_ago]
last_days_ago = days_ago
end

View file

@ -16,6 +16,11 @@ describe TimelineLookup do
expect(result).to eq([[1, 10], [3, 8]])
end
it "respects holes in the post numbers" do
result = TimelineLookup.build([[111, 1, 10], [222, 12, 10], [333, 30, 8]])
expect(result).to eq([[1, 10], [3, 8]])
end
it "respects a `max_values` setting" do
input = (1..100).map {|i| [1000+i, i, 100-i] }