Show More
@@ -7,11 +7,9 b' from django.db.models import Count' | |||||
7 | MAX_TAG_FONT = 1 |
|
7 | MAX_TAG_FONT = 1 | |
8 | MIN_TAG_FONT = 0.2 |
|
8 | MIN_TAG_FONT = 0.2 | |
9 |
|
9 | |||
10 |
TAG_POPULARITY_MULTIPLIER = |
|
10 | TAG_POPULARITY_MULTIPLIER = 20 | |
11 |
|
11 | |||
12 | OPENING_POST_POPULARITY = 0.1 |
|
12 | ARCHIVE_POPULARITY_MODIFIER = 0.5 | |
13 | REPLY_POPULARITY = 0.005 |
|
|||
14 | ARCHIVE_POPULARITY_MODIFIER = 0.1 |
|
|||
15 |
|
13 | |||
16 |
|
14 | |||
17 | class TagManager(models.Manager): |
|
15 | class TagManager(models.Manager): | |
@@ -54,7 +52,11 b' class Tag(models.Model):' | |||||
54 | tag_reply_count = 0.0 |
|
52 | tag_reply_count = 0.0 | |
55 |
|
53 | |||
56 | for thread in self.threads.all(): |
|
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 | popularity = tag_reply_count / all_post_count |
|
61 | popularity = tag_reply_count / all_post_count | |
60 |
|
62 | |||
@@ -84,7 +86,7 b' class Tag(models.Model):' | |||||
84 |
|
86 | |||
85 | popularity = self.get_popularity() |
|
87 | popularity = self.get_popularity() | |
86 |
|
88 | |||
87 | font_value = popularity * TAG_POPULARITY_MULTIPLIER |
|
89 | font_value = popularity * Tag.objects.all().count() | |
88 |
|
|
90 | font_value = max(font_value, MIN_TAG_FONT) | |
89 | font_value = min(font_value, MAX_TAG_FONT) |
|
91 | font_value = min(font_value, MAX_TAG_FONT) | |
90 |
|
92 |
General Comments 0
You need to be logged in to leave comments.
Login now