Skip to content

Commit

Permalink
Fix ordering of latest responses in Django adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
gunthercox committed Mar 4, 2018
1 parent b50f37a commit 62b68b2
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
2 changes: 1 addition & 1 deletion chatterbot/storage/django_storage.py
Expand Up @@ -159,7 +159,7 @@ def get_latest_response(self, conversation_id):
conversations__id=conversation_id
).order_by(
'created_at'
).first()
).last()

if not response:
return None
Expand Down
3 changes: 0 additions & 3 deletions tests_django/test_django_adapter.py
@@ -1,4 +1,3 @@
from unittest import expectedFailure
from django.test import TestCase
from chatterbot.storage import DjangoStorageAdapter
from chatterbot.ext.django_chatterbot.factories import (
Expand Down Expand Up @@ -52,7 +51,6 @@ def test_get_latest_response_from_one_responses(self):

self.assertEqual(response_1.response, response)

@expectedFailure
def test_get_latest_response_from_two_responses(self):
conversation = ConversationFactory()
response_1 = ResponseFactory(
Expand All @@ -69,7 +67,6 @@ def test_get_latest_response_from_two_responses(self):

self.assertEqual(response_2.response, response)

@expectedFailure
def test_get_latest_response_from_three_responses(self):
conversation = ConversationFactory()
response_1 = ResponseFactory(
Expand Down

0 comments on commit 62b68b2

Please sign in to comment.