##// END OF EJS Templates
More fixes for tags popularity...
neko259 -
r601:b97d4c21 default
parent child Browse files
Show More
@@ -7,11 +7,9 b' from django.db.models import Count'
7 7 MAX_TAG_FONT = 1
8 8 MIN_TAG_FONT = 0.2
9 9
10 TAG_POPULARITY_MULTIPLIER = 10
10 TAG_POPULARITY_MULTIPLIER = 20
11 11
12 OPENING_POST_POPULARITY = 0.1
13 REPLY_POPULARITY = 0.005
14 ARCHIVE_POPULARITY_MODIFIER = 0.1
12 ARCHIVE_POPULARITY_MODIFIER = 0.5
15 13
16 14
17 15 class TagManager(models.Manager):
@@ -54,7 +52,11 b' class Tag(models.Model):'
54 52 tag_reply_count = 0.0
55 53
56 54 for thread in self.threads.all():
57 tag_reply_count += thread.get_reply_count()
55 if thread.archived:
56 modifier = ARCHIVE_POPULARITY_MODIFIER
57 else:
58 modifier = 1
59 tag_reply_count += thread.get_reply_count() * modifier
58 60
59 61 popularity = tag_reply_count / all_post_count
60 62
@@ -84,8 +86,8 b' class Tag(models.Model):'
84 86
85 87 popularity = self.get_popularity()
86 88
87 font_value = popularity * TAG_POPULARITY_MULTIPLIER
88 font_value = max(font_value, MIN_TAG_FONT)
89 font_value = popularity * Tag.objects.all().count()
90 font_value = max(font_value, MIN_TAG_FONT)
89 91 font_value = min(font_value, MAX_TAG_FONT)
90 92
91 93 return str(font_value)
General Comments 0
You need to be logged in to leave comments. Login now