Fix the number of minutes for a counter to be inactive to 10

This commit is contained in:
guillaume-renaud 2016-10-16 19:30:39 +02:00 committed by Skia
parent 63f10c13d4
commit be7e0401dd
2 changed files with 11 additions and 3 deletions

View File

@ -223,10 +223,10 @@ class Counter(models.Model):
def is_inactive(self): def is_inactive(self):
""" """
Returns True if the counter self is inactive from 5 minutes, else False Returns True if the counter self is inactive from 10 minutes, else False
""" """
if (self.is_open()): if (self.is_open()):
return ((timezone.now() - self.permanencies.model.objects.order_by('-activity').first().activity) > datetime.timedelta(minutes=5)) return ((timezone.now() - self.permanencies.model.objects.order_by('-activity').first().activity) > datetime.timedelta(minutes=10))
else: else:
return False return False

View File

@ -8,13 +8,21 @@
{% block content %} {% block content %}
<h3>{% trans counter_name=counter %}{{ counter_name }} activity{% endtrans %}</h3> <h3>{% trans counter_name=counter %}{{ counter_name }} activity{% endtrans %}</h3>
{% if counter.type == 'BAR' %} {% if counter.type == 'BAR' %}
<h4>{% trans %}Barman list{% endtrans %}</h4> <h4>{% trans %}Barmen list{% endtrans %}</h4>
<ul> <ul>
{% for b in counter.get_barmen_list() %} {% for b in counter.get_barmen_list() %}
<li>{{ user_profile_link(b) }}</li> <li>{{ user_profile_link(b) }}</li>
{% endfor %} {% endfor %}
</ul> </ul>
{% endif %} {% endif %}
<h5>{% trans %}Legend{% endtrans %}</h5>
<span style="color: green">&#x2713;</span> : {% trans %}counter is open, there's at least one barman connected{% endtrans %}
<br>
<span style="color: orange">&#x3f;</span> : {% trans %}counter is open but not active, the last sale was done at least 10 minutes ago {% endtrans %}
<br>
<span style="color: red">&#10007;</span> : {% trans %}counter is not open : no one is connected{% endtrans %}
{% endblock %} {% endblock %}