diff --git a/osinaweb/db.sqlite3 b/osinaweb/db.sqlite3
index 7afb0d59..c1ff7e21 100644
Binary files a/osinaweb/db.sqlite3 and b/osinaweb/db.sqlite3 differ
diff --git a/osinaweb/osichat/__pycache__/consumers.cpython-310.pyc b/osinaweb/osichat/__pycache__/consumers.cpython-310.pyc
index 36f754d5..0c8d8153 100644
Binary files a/osinaweb/osichat/__pycache__/consumers.cpython-310.pyc and b/osinaweb/osichat/__pycache__/consumers.cpython-310.pyc differ
diff --git a/osinaweb/osichat/consumers.py b/osinaweb/osichat/consumers.py
index 1d33f8ff..d4e47b3a 100644
--- a/osinaweb/osichat/consumers.py
+++ b/osinaweb/osichat/consumers.py
@@ -7,8 +7,7 @@ from django.shortcuts import get_object_or_404
import requests
from django.forms.models import model_to_dict
from django.core.serializers.json import DjangoJSONEncoder
-
-
+from django.db.models import Case, When, F, Max, DateTimeField
class OsitcomVisitor(WebsocketConsumer):
def connect(self):
async_to_sync(self.channel_layer.group_add)(
@@ -72,10 +71,17 @@ class OsitcomChatRooms(WebsocketConsumer):
def get_chats_handler(self):
- chat_rooms = ChatRoom.objects.annotate(last_update=Max('chatmessage__date_sent')).order_by('-last_update', '-date_created')
+
+ chat_rooms = ChatRoom.objects.annotate(last_update=Max('chatmessage__date_sent'),
+ order_key=Case(
+ When(last_update__isnull=True, then=F('date_created')),
+ default=F('last_update'),
+ output_field=DateTimeField(),)).order_by('-order_key')
+
user = get_object_or_404(User, id=self.user_id)
for room in chat_rooms:
room.number_of_unread = room.unread_messages(user)
+ room.last_message = room.last_updated
context = {
'chat_rooms': chat_rooms,
}
@@ -125,7 +131,7 @@ class OsitcomChatRooms(WebsocketConsumer):
class OsitcomChatRoom(WebsocketConsumer):
def connect(self):
- self.domain = 'http://192.168.1.111:8000'
+ self.domain = 'http://192.168.1.109:8000'
self.session_id = self.scope['url_route']['kwargs']['session_id']
self.visitor = Visitor.objects.filter(session_id=self.session_id).last()
diff --git a/osinaweb/osinacore/templates/details_templates/project-details.html b/osinaweb/osinacore/templates/details_templates/project-details.html
index 92789a75..a7cdae8d 100644
--- a/osinaweb/osinacore/templates/details_templates/project-details.html
+++ b/osinaweb/osinacore/templates/details_templates/project-details.html
@@ -330,7 +330,7 @@
-
+