Merge dev to dev-MVC

This commit is contained in:
Silversthorn 2021-09-21 21:13:17 +02:00
parent 186dcdc616
commit 5146a490df
2 changed files with 21 additions and 0 deletions

View File

@ -118,6 +118,12 @@ class Servers_Controller:
def can_stop_no_players(server_id, time_limit):
return servers_helper.can_stop_no_players(server_id, time_limit)
def set_waiting_start(server_id, value):
servers_helper.set_waiting_start(server_id, value)
@staticmethod
def get_waiting_start(server_id):
return servers_helper.get_waiting_start(server_id)
#************************************************************************************************
# Servers Helpers Methods

View File

@ -76,6 +76,7 @@ class Server_Stats(Model):
desc = CharField(default="Unable to Connect")
version = CharField(default="")
updating = BooleanField(default=False)
waiting_start = BooleanField(default=False)
class Meta:
@ -187,5 +188,19 @@ class helper_servers:
can = True
return can
@staticmethod
def set_waiting_start(server_id, value):
try:
row = Server_Stats.select().where(Server_Stats.server_id == server_id)
except Exception as ex:
logger.error("Database entry not found. ".format(ex))
with database.atomic():
Server_Stats.update(waiting_start=value).where(Server_Stats.server_id == server_id).execute()
@staticmethod
def get_waiting_start(server_id):
waiting_start = Server_Stats.select().where(Server_Stats.server_id == server_id).get()
return waiting_start.waiting_start
servers_helper = helper_servers()