Bug Fix:Remove nil cached_tag_lists when Collecting Tags (#11648)

This commit is contained in:
Molly Struve 2020-11-30 08:18:19 -05:00 committed by GitHub
parent df31a94f2e
commit fd97007364
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -31,10 +31,10 @@ module Follows
last_100_long_page_view_article_ids = user.page_views.where(time_tracked_in_seconds: 45..)
.pluck(:article_id).last(100)
articles = Article.where(id: last_100_reactable_ids + last_100_long_page_view_article_ids)
tags = articles.pluck(:cached_tag_list).flat_map { |list| list.split(", ") }
tags = articles.pluck(:cached_tag_list).compact.flat_map { |list| list.split(", ") }
occurrences = tags.count(tag.name)
bonus = inverse_popularity_bonus(tag)
Math.log(occurrences + bonus + 1) # +1 is purelt to avoid log(0) => -infinity
Math.log(occurrences + bonus + 1) # +1 is purely to avoid log(0) => -infinity
end
def adjust_other_tag_follows_of_user(user_id)