Remove the question mark from the counter state

En raison de la manière dont le timeout marche et de l'activité des comptoirs, la notion de "comptoir inactif" n'est pas intuitive. Un comptoir est ouvert ou fermé. Point.
This commit is contained in:
imperosol 2024-10-09 23:30:59 +02:00
parent 8f0ee4df6d
commit 4bc4d266c2
3 changed files with 3 additions and 24 deletions

View File

@ -77,9 +77,7 @@
{% else %}
<a href="{{ url('counter:activity', counter_id=bar.id) }}">
{% endif %}
{% if bar.is_inactive() %}
<i class="fa fa-question" style="color: #f39c12"></i>
{% elif bar.is_open %}
{% if bar.is_open %}
<i class="fa fa-check" style="color: #2ecc71"></i>
{% else %}
<i class="fa fa-times" style="color: #eb2f06"></i>

View File

@ -473,21 +473,6 @@ class Counter(models.Model):
"""Update the barman activity to prevent timeout."""
self.permanencies.filter(end=None).update(activity=timezone.now())
@property
def is_open(self) -> bool:
return len(self.barmen_list) > 0
def is_inactive(self) -> bool:
"""Returns True if the counter self is inactive from SITH_COUNTER_MINUTE_INACTIVE's value minutes, else False."""
return self.is_open and (
(timezone.now() - self.permanencies.order_by("-activity").first().activity)
> timedelta(minutes=settings.SITH_COUNTER_MINUTE_INACTIVE)
)
def barman_list(self) -> list[int]:
"""Returns the barman id list."""
return [b.id for b in self.barmen_list]
def can_refill(self) -> bool:
"""Show if the counter authorize the refilling with physic money."""
if self.type != "BAR":

View File

@ -30,10 +30,6 @@
<i class="fa fa-check" style="color: #2ecc71"></i>
<span>{% trans %}counter is open, there's at least one barman connected{% endtrans %}</span>
</div>
<div>
<i class="fa fa-question" style="color: #f39c12"></i>
<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 %}</span>
</div>
<div>
<i class="fa fa-times" style="color: #eb2f06"></i>
<span>{% trans %}counter is not open : no one is connected{% endtrans %}</span>