mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-09 19:40:19 +00:00
Add inactive state for counters
This commit is contained in:
@ -11,6 +11,7 @@ import random
|
||||
import string
|
||||
import os
|
||||
import base64
|
||||
import datetime
|
||||
|
||||
from club.models import Club
|
||||
from accounting.models import CurrencyField
|
||||
@ -220,6 +221,15 @@ class Counter(models.Model):
|
||||
def is_open(self):
|
||||
return len(self.get_barmen_list()) > 0
|
||||
|
||||
def is_inactive(self):
|
||||
"""
|
||||
Returns True if the counter self is inactive from 5 minutes, else False
|
||||
"""
|
||||
if (self.is_open()):
|
||||
return ((timezone.now() - self.permanencies.model.objects.order_by('-activity').first().activity) > datetime.timedelta(minutes=5))
|
||||
else:
|
||||
return False
|
||||
|
||||
def barman_list(self):
|
||||
"""
|
||||
Returns the barman id list
|
||||
|
Reference in New Issue
Block a user