FEATURE: add a Top Categories section to the user summary page, showing the categories in which a user has the most activity

This commit is contained in:
Neil Lalonde
2018-07-18 16:37:50 -04:00
parent 2dc3a50dac
commit afc94ac9e4
8 changed files with 130 additions and 3 deletions

View File

@ -11,16 +11,21 @@ describe UserSummary do
expect(summary.topics.length).to eq(1)
expect(summary.replies.length).to eq(1)
expect(summary.top_categories.length).to eq(1)
expect(summary.top_categories.first[:topic_count]).to eq(1)
expect(summary.top_categories.first[:post_count]).to eq(1)
topic.update_columns(deleted_at: Time.now)
expect(summary.topics.length).to eq(0)
expect(summary.replies.length).to eq(0)
expect(summary.top_categories.length).to eq(0)
topic.update_columns(deleted_at: nil, visible: false)
expect(summary.topics.length).to eq(0)
expect(summary.replies.length).to eq(0)
expect(summary.top_categories.length).to eq(0)
category = Fabricate(:category)
topic.update_columns(category_id: category.id, deleted_at: nil, visible: true)
@ -30,7 +35,7 @@ describe UserSummary do
expect(summary.topics.length).to eq(0)
expect(summary.replies.length).to eq(0)
expect(summary.top_categories.length).to eq(0)
end
end