mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Replace .count() != 0
with .exists()
This commit is contained in:
parent
8f1630b6a2
commit
166272e12c
@ -350,7 +350,7 @@ class HelpersManagement:
|
||||
compress: bool = False,
|
||||
):
|
||||
logger.debug(f"Updating server {server_id} backup config with {locals()}")
|
||||
if Backups.select().where(Backups.server_id == server_id).count() != 0:
|
||||
if Backups.select().where(Backups.server_id == server_id).exists():
|
||||
new_row = False
|
||||
conf = {}
|
||||
else:
|
||||
|
@ -89,4 +89,4 @@ class HelperRoles:
|
||||
|
||||
@staticmethod
|
||||
def role_id_exists(role_id) -> bool:
|
||||
return Roles.select().where(Roles.role_id == role_id).count() != 0
|
||||
return Roles.select().where(Roles.role_id == role_id).exists()
|
||||
|
@ -275,7 +275,7 @@ class HelperUsers:
|
||||
|
||||
@staticmethod
|
||||
def user_id_exists(user_id):
|
||||
return Users.select().where(Users.user_id == user_id).count() != 0
|
||||
return Users.select().where(Users.user_id == user_id).exists()
|
||||
|
||||
# **********************************************************************************
|
||||
# User_Roles Methods
|
||||
|
@ -43,7 +43,7 @@ class ApiServersServerActionHandler(BaseApiHandler):
|
||||
|
||||
def _clone_server(self, server_id, user_id):
|
||||
def is_name_used(name):
|
||||
return Servers.select().where(Servers.server_name == name).count() != 0
|
||||
return Servers.select().where(Servers.server_name == name).exists()
|
||||
|
||||
server_data = self.controller.servers.get_server_data_by_id(server_id)
|
||||
server_uuid = server_data.get("server_uuid")
|
||||
|
Loading…
Reference in New Issue
Block a user