mirror of
https://github.com/dkmstr/openuds.git
synced 2025-03-31 22:50:32 +03:00
bitarray library previously returned True or False, now return 0 and 1, and we where checking against "is True"
This commit is contained in:
parent
02c3ffbe75
commit
7edf3094ed
@ -129,7 +129,7 @@ class CalendarChecker:
|
||||
|
||||
return next_event
|
||||
|
||||
def check(self, dtime=None):
|
||||
def check(self, dtime=None) -> bool:
|
||||
"""
|
||||
Checks if the given time is a valid event on calendar
|
||||
@param dtime: Datetime object to check
|
||||
@ -157,7 +157,7 @@ class CalendarChecker:
|
||||
CalendarChecker.cache.put(cacheKey, data.tobytes(), 3600 * 24)
|
||||
memCache.set(cacheKey, data.tobytes(), 3600*24)
|
||||
|
||||
return data[dtime.hour * 60 + dtime.minute]
|
||||
return bool(data[dtime.hour * 60 + dtime.minute])
|
||||
|
||||
def nextEvent(self, checkFrom=None, startEvent=True, offset=None):
|
||||
"""
|
||||
|
@ -124,7 +124,7 @@ class MetaPool(UUIDModel, TaggingMixin): # type: ignore
|
||||
access = self.fallbackAccess
|
||||
# Let's see if we can access by current datetime
|
||||
for ac in sorted(self.calendarAccess.all(), key=lambda x: x.priority):
|
||||
if CalendarChecker(ac.calendar).check(chkDateTime) is True:
|
||||
if CalendarChecker(ac.calendar).check(chkDateTime):
|
||||
access = ac.access
|
||||
break # Stops on first rule match found
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user