No idea why these tests weren't failing for me in guard when I pushed last time. Fixed!

This commit is contained in:
Robin Ward 2013-04-01 14:54:53 -04:00
parent 4e6b62b1f5
commit b54054c1d3
1 changed files with 10 additions and 0 deletions

View File

@ -28,6 +28,16 @@ class TopicQuery
end end
def order_hotness def order_hotness
# When anonymous, don't use topic_user
if @user.blank?
return "CASE
WHEN topics.pinned_at IS NOT NULL THEN 100
ELSE hot_topics.score + (COALESCE(categories.hotness, 5.0) / 11.0)
END DESC"
end
# When logged in take into accounts what pins you've closed
"CASE "CASE
WHEN (COALESCE(topics.pinned_at, '#{lowest_date}') > COALESCE(tu.cleared_pinned_at, '#{lowest_date}')) WHEN (COALESCE(topics.pinned_at, '#{lowest_date}') > COALESCE(tu.cleared_pinned_at, '#{lowest_date}'))
THEN 100 THEN 100