diff --git a/osinaweb/osichat/__pycache__/consumers.cpython-310.pyc b/osinaweb/osichat/__pycache__/consumers.cpython-310.pyc index d8141857..d88c731d 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 8477eaff..e6bf4e12 100644 --- a/osinaweb/osichat/consumers.py +++ b/osinaweb/osichat/consumers.py @@ -170,7 +170,8 @@ class Osichat(WebsocketConsumer): def get_visitors_handler(self, event): - visitors = Visitor.objects.all() + today = timezone.now().date() + visitors = Visitor.objects.filter(visitorlog__visit_date__date=today).annotate(latest_visit=Max('visitorlog__visit_date')).order_by('-latest_visit') context = { 'visitors': visitors, } diff --git a/osinaweb/osinacore/templates/chat_templates/partials/visitors.html b/osinaweb/osinacore/templates/chat_templates/partials/visitors.html index 4e82a7be..09fafaa6 100644 --- a/osinaweb/osinacore/templates/chat_templates/partials/visitors.html +++ b/osinaweb/osinacore/templates/chat_templates/partials/visitors.html @@ -1,47 +1 @@ -{% load static %} - -
Visitors today
-{{visitor.ip_address}}
-- {% if not visitor.visitorlog_set.all.last.title %} - {{ visitor.visitorlog_set.all.last.url|slice:":26" }}{% if visitor.visitorlog_set.all.last.url|length > 26 %}…{% endif %} - {% else %} - {{ visitor.visitorlog_set.all.last.title|slice:":26" }}{% if visitor.visitorlog_set.all.last.title|length > 26 %}…{% endif %} - {% endif %} -
-{{visitor.total_duration}}
-