mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-24 18:14:22 +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" %}
|
{% cache 100 "counters_activity" %}
|
||||||
{% for bar in Counter.objects.annotate_has_barman(user).filter(type="BAR") %}
|
{% for bar in Counter.objects.annotate_has_barman(user).filter(type="BAR") %}
|
||||||
<li>
|
<li>
|
||||||
{# If the user is a barman, we redirect him directly to the barman page
|
{# If the user is a barman, we redirect him directly to the barman page
|
||||||
else we redirect him to the activity page #}
|
else we redirect him to the activity page #}
|
||||||
{% if bar.has_annotated_barman %}
|
{% if bar.has_annotated_barman %}
|
||||||
<a href="{{ url('counter:details', counter_id=bar.id) }}">
|
<a href="{{ url('counter:details', counter_id=bar.id) }}">
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="{{ url('counter:activity', counter_id=bar.id) }}">
|
<a href="{{ url('counter:activity', counter_id=bar.id) }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if bar.is_inactive() %}
|
{% if bar.is_open %}
|
||||||
<i class="fa fa-question" style="color: #f39c12"></i>
|
|
||||||
{% elif bar.is_open %}
|
|
||||||
<i class="fa fa-check" style="color: #2ecc71"></i>
|
<i class="fa fa-check" style="color: #2ecc71"></i>
|
||||||
{% else %}
|
{% else %}
|
||||||
<i class="fa fa-times" style="color: #eb2f06"></i>
|
<i class="fa fa-times" style="color: #eb2f06"></i>
|
||||||
|
@ -473,21 +473,6 @@ class Counter(models.Model):
|
|||||||
"""Update the barman activity to prevent timeout."""
|
"""Update the barman activity to prevent timeout."""
|
||||||
self.permanencies.filter(end=None).update(activity=timezone.now())
|
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:
|
def can_refill(self) -> bool:
|
||||||
"""Show if the counter authorize the refilling with physic money."""
|
"""Show if the counter authorize the refilling with physic money."""
|
||||||
if self.type != "BAR":
|
if self.type != "BAR":
|
||||||
|
@ -30,10 +30,6 @@
|
|||||||
<i class="fa fa-check" style="color: #2ecc71"></i>
|
<i class="fa fa-check" style="color: #2ecc71"></i>
|
||||||
<span>{% trans %}counter is open, there's at least one barman connected{% endtrans %}</span>
|
<span>{% trans %}counter is open, there's at least one barman connected{% endtrans %}</span>
|
||||||
</div>
|
</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>
|
<div>
|
||||||
<i class="fa fa-times" style="color: #eb2f06"></i>
|
<i class="fa fa-times" style="color: #eb2f06"></i>
|
||||||
<span>{% trans %}counter is not open : no one is connected{% endtrans %}</span>
|
<span>{% trans %}counter is not open : no one is connected{% endtrans %}</span>
|
||||||
|
Loading…
Reference in New Issue
Block a user