mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Make model *_exists functions way more efficient
This commit is contained in:
parent
0115421243
commit
65ba65a67d
@ -70,6 +70,4 @@ class HelperRoles:
|
||||
|
||||
@staticmethod
|
||||
def role_id_exists(role_id):
|
||||
if not HelperRoles.get_role(role_id):
|
||||
return False
|
||||
return True
|
||||
return Roles.select().where(Roles.role_id == role_id).count() != 0
|
||||
|
@ -205,9 +205,7 @@ class HelperServers:
|
||||
|
||||
@staticmethod
|
||||
def server_id_exists(server_id):
|
||||
if not HelperServers.get_server_data_by_id(server_id):
|
||||
return False
|
||||
return True
|
||||
return Servers.select().where(Servers.server_id == server_id).count() != 0
|
||||
|
||||
@staticmethod
|
||||
def sever_crashed(server_id):
|
||||
|
@ -249,9 +249,7 @@ class HelperUsers:
|
||||
|
||||
@staticmethod
|
||||
def user_id_exists(user_id):
|
||||
if not HelperUsers.get_user(user_id):
|
||||
return False
|
||||
return True
|
||||
return Users.select().where(Users.user_id == user_id).count() != 0
|
||||
|
||||
# **********************************************************************************
|
||||
# User_Roles Methods
|
||||
|
Loading…
Reference in New Issue
Block a user