From bce103ac7af62b299b5770a2574658d19ac18790 Mon Sep 17 00:00:00 2001 From: Adolfo Fitoria Date: Tue, 2 Oct 2012 19:14:57 -0600 Subject: fixing some tests and merge errors, commit before the lights goes out --- askbot/auth.py | 10 +++++----- askbot/const/__init__.py | 8 ++++---- askbot/search/haystack/__init__.py | 2 +- askbot/tests/badge_tests.py | 2 +- askbot/tests/haystack_search_tests.py | 2 +- askbot/views/users.py | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/askbot/auth.py b/askbot/auth.py index c80f5db1..846445b4 100644 --- a/askbot/auth.py +++ b/askbot/auth.py @@ -238,7 +238,7 @@ def onAnswerAcceptCanceled(answer, user, timestamp=None): reputation.save() if answer.author == question.author and user == question.author: - #a symmettric measure for the reputation gaming plug + #a symmettric measure for the reputation gaming plug #as in the onAnswerAccept function #here it protects the user from uwanted reputation loss return @@ -263,7 +263,7 @@ def onUpVoted(vote, post, user, timestamp=None): if post.post_type != 'comment': post.vote_up_count = int(post.vote_up_count) + 1 - post.score = int(post.score) + 1 + post.points = int(post.points) + 1 post.save() if post.post_type == 'comment': @@ -300,7 +300,7 @@ def onUpVotedCanceled(vote, post, user, timestamp=None): if post.vote_up_count < 0: post.vote_up_count = 0 - post.score = int(post.score) - 1 + post.points = int(post.points) - 1 post.save() if post.post_type == 'comment': @@ -333,7 +333,7 @@ def onDownVoted(vote, post, user, timestamp=None): vote.save() post.vote_down_count = int(post.vote_down_count) + 1 - post.score = int(post.score) - 1 + post.points = int(post.points) - 1 post.save() if not (post.wiki or post.is_anonymous): @@ -375,7 +375,7 @@ def onDownVotedCanceled(vote, post, user, timestamp=None): post.vote_down_count = int(post.vote_down_count) - 1 if post.vote_down_count < 0: post.vote_down_count = 0 - post.score = post.score + 1 + post.points = post.points + 1 post.save() if not (post.wiki or post.is_anonymous): diff --git a/askbot/const/__init__.py b/askbot/const/__init__.py index 5f47bb79..977cf0c5 100644 --- a/askbot/const/__init__.py +++ b/askbot/const/__init__.py @@ -299,7 +299,7 @@ POST_STATUS = { 'deleted': _('[deleted]'), 'default_version': _('initial version'), 'retagged': _('retagged'), - 'private': _('[private]') + 'private': _('[private]') } #choices used in email and display filters @@ -361,7 +361,7 @@ DEFAULT_USER_STATUS = 'w' #number of items to show in user views USER_VIEW_DATA_SIZE = 50 -#not really dependency, but external links, which it would +#not really dependency, but external links, which it would #be nice to test for correctness from time to time DEPENDENCY_URLS = { 'akismet': 'https://akismet.com/signup/', @@ -411,8 +411,8 @@ SEARCH_ORDER_BY = ( ('last_activity_at', _('activity ascendant')), ('-answer_count', _('answers descendant')), ('answer_count', _('answers ascendant')), - ('-score', _('votes descendant')), - ('score', _('votes ascendant')), + ('-points', _('votes descendant')), + ('points', _('votes ascendant')), ) DEFAULT_QUESTION_WIDGET_STYLE = """ diff --git a/askbot/search/haystack/__init__.py b/askbot/search/haystack/__init__.py index 71f04d00..e6576d4a 100644 --- a/askbot/search/haystack/__init__.py +++ b/askbot/search/haystack/__init__.py @@ -53,7 +53,7 @@ try: #FIXME: add a highlight here? id_list.append(r.pk) - return model_klass.objects.filter(id__in=set(id_list)) + return model_klass.objects.filter(id__in=set(id_list)).distinct() except: pass diff --git a/askbot/tests/badge_tests.py b/askbot/tests/badge_tests.py index 8e4458f6..c184db6f 100644 --- a/askbot/tests/badge_tests.py +++ b/askbot/tests/badge_tests.py @@ -70,7 +70,7 @@ class BadgeTests(AskbotTestCase): #post another question and check that there are no new badges question2 = self.post_question(user = self.u1) answer2 = self.post_answer(user = self.u2, question = question2) - answer2.score = min_score - 1 + answer2.score = min_points - 1 answer2.save() self.u1.upvote(answer2) diff --git a/askbot/tests/haystack_search_tests.py b/askbot/tests/haystack_search_tests.py index d5935ff6..82e73cc0 100644 --- a/askbot/tests/haystack_search_tests.py +++ b/askbot/tests/haystack_search_tests.py @@ -53,8 +53,8 @@ class HaystackSearchTests(AskbotTestCase): def test_title_search(self): #title search title_search_qs = models.Thread.objects.get_for_query('title') - self.assertEquals(title_search_qs.count(), 2) title_search_qs_2 = models.Thread.objects.get_for_query('Nome') + self.assertEquals(title_search_qs.count(), 2) self.assertEquals(title_search_qs_2.count(), 1) @skipIf('haystack' not in settings.INSTALLED_APPS, diff --git a/askbot/views/users.py b/askbot/views/users.py index ee3c7d91..c2f11328 100644 --- a/askbot/views/users.py +++ b/askbot/views/users.py @@ -391,7 +391,7 @@ def user_stats(request, user, context): ).select_related( 'thread' ).order_by( - '-score', '-added_at' + '-points', '-added_at' )[:100] top_answer_count = len(top_answers) -- cgit v1.2.3-1-g7c22