group the "suggested topics" by category correctly.

in the past new topics were not prioritizing current category and
new topics in a category were not being inserted before other unread topics
in other categories
This commit is contained in:
Sam
2013-08-28 10:51:49 +10:00
parent c0f610daf6
commit 28466eb5b2
3 changed files with 68 additions and 9 deletions

View File

@ -87,10 +87,10 @@ class TopicQuery
# When logged in we start with different results
if @user
builder.add_results(unread_results(topic: topic, per_page: builder.results_left))
builder.add_results(new_results(per_page: builder.results_left)) unless builder.full?
builder.add_results(unread_results(topic: topic, per_page: builder.results_left), :high)
builder.add_results(new_results(topic: topic, per_page: builder.category_results_left), :high) unless builder.category_full?
end
builder.add_results(random_suggested(topic, builder.results_left)) unless builder.full?
builder.add_results(random_suggested(topic, builder.results_left), :low) unless builder.full?
create_list(:suggested, {}, builder.results)
end