Fix some bugs..

This commit is contained in:
sepehr 2024-07-31 17:42:42 +03:30
parent ef3ce0e133
commit b220c6b98a
3 changed files with 3 additions and 6 deletions

View file

@ -247,7 +247,8 @@ def syslog_list():
else:
clauses.append(syslog.created >= datetime.datetime.now()-datetime.timedelta(days=1))
if event_end_time:
event_end_time=datetime.datetime.strptime(event_end_time, "%Y-%m-%d %H:%M:%S")
event_end_time=event_end_time.split(".000Z")[0]
event_end_time=datetime.datetime.strptime(event_end_time, "%Y-%m-%dT%H:%M:%S")
clauses.append(syslog.created <= event_end_time)
else:
clauses.append(syslog.created <= datetime.datetime.now())

View file

@ -78,12 +78,8 @@ class Auth(BaseModel):
auth=auth.where(Auth.started > timestamp-2,Auth.started < timestamp+2)
time.sleep(0.3)
count+=1
log.error(count)
else:
auth=False
log.error(auth)
if auth:
log.error(list(auth))
if auth and len(list(auth))>0:
auth=list(auth)
for a in auth:

View file

@ -31,7 +31,7 @@ class DevUserGroupPermRel(BaseModel):
def __repr__(self):
return "DevUserGroupPermRel: user_id: %s, group_id: %s, perm_id: %s" % (self.user_id, self.group_id, self.perm_id)
def get_user_devices(uid,group_id):
def get_user_devices(uid,group_id=False):
perms=list(DevUserGroupPermRel.select().where(DevUserGroupPermRel.user_id == uid))
for perm in perms:
if group_id==1 or (perm.group_id.id == 1 and not group_id):