mirror of
https://github.com/ae-utbm/sith.git
synced 2024-12-25 09:11:13 +00:00
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:
parent
8f0ee4df6d
commit
4bc4d266c2
@ -70,16 +70,14 @@
|
||||
{% cache 100 "counters_activity" %}
|
||||
{% for bar in Counter.objects.annotate_has_barman(user).filter(type="BAR") %}
|
||||
<li>
|
||||
{# If the user is a barman, we redirect him directly to the barman page
|
||||
else we redirect him to the activity page #}
|
||||
{# If the user is a barman, we redirect him directly to the barman page
|
||||
else we redirect him to the activity page #}
|
||||
{% if bar.has_annotated_barman %}
|
||||
<a href="{{ url('counter:details', counter_id=bar.id) }}">
|
||||
{% 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>
|
||||
|
@ -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":
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user