Commit 57b663c4 authored by Lo-J's avatar Lo-J Committed by Skia

counter inactive state with settings variable, traduction file problem fixed

parent 7f6424d5
......@@ -223,12 +223,9 @@ class Counter(models.Model):
def is_inactive(self):
"""
Returns True if the counter self is inactive from 10 minutes, else False
Returns True if the counter self is inactive from SITH_COUNTER_MINUTE_INACTIVE's value minutes, else False
"""
if (self.is_open()):
return ((timezone.now() - self.permanencies.model.objects.order_by('-activity').first().activity) > datetime.timedelta(minutes=10))
else:
return False
return self.is_open() and ((timezone.now() - self.permanencies.order_by('-activity').first().activity) > datetime.timedelta(minutes=settings.SITH_COUNTER_MINUTE_INACTIVE))
def barman_list(self):
"""
......
......@@ -16,11 +16,10 @@
</ul>
{% endif %}
<h5>{% trans %}Legend{% endtrans %}</h5>
<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 %}
<span style="color: orange">&#x3f;</span> : {% trans minutes=settings.SITH_COUNTER_MINUTE_INACTIVE %}counter is open but not active, the last sale was done at least {{ minutes }} minutes ago {% endtrans %}
<br>
<span style="color: red">&#10007;</span> : {% trans %}counter is not open : no one is connected{% endtrans %}
{% endblock %}
......
This diff is collapsed.
......@@ -191,7 +191,6 @@ STATIC_URL = '/static/'
STATIC_ROOT = './static/'
# Auth configuration
AUTH_USER_MODEL = 'core.User'
AUTH_ANONYMOUS_MODEL = 'core.models.AnonymousUser'
LOGIN_URL = '/login'
......@@ -413,6 +412,9 @@ SITH_BARMAN_TIMEOUT=20
# Minutes to delete the last operations
SITH_LAST_OPERATIONS_LIMIT=5
# Minutes for a counter to be inactive
SITH_COUNTER_MINUTE_INACTIVE=10
# ET variables
SITH_EBOUTIC_ET_URL = "https://preprod-tpeweb.e-transactions.fr/cgi/MYchoix_pagepaiement.cgi"
SITH_EBOUTIC_PBX_SITE = "4000666"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment