emile 9 months ago
parent 944f63b38f
commit 31c4cb8c84

@ -31,7 +31,7 @@ class Visitor(models.Model):
def total_duration(self): def total_duration(self):
total_seconds = 0 total_seconds = 0
for log in self.visitorlog_set.all(): for log in self.visitorlog_set.all():
end_time = log.left_date if log.left_date else datetime.now(timezone.utc) end_time = log.left_date if log.left_date else timezone.now()
total_seconds += (end_time - log.visit_date).total_seconds() total_seconds += (end_time - log.visit_date).total_seconds()
duration = timedelta(seconds=total_seconds) duration = timedelta(seconds=total_seconds)

@ -38,7 +38,7 @@
</div> </div>
<p class="duration text-gray-500 text-sm">{{visitor.total_duration}}</p>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>

Loading…
Cancel
Save