mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2025-01-19 09:45:28 +01:00
Don't use get_latest_server_stats
Use get_server_stats_by_id instead of get_latest_server_stats The reasoning behind this is that all usages of get_latest_server_stats had `DatabaseShortcuts.return_rows(latest)[0]`, which get_server_stats_by_id already did
This commit is contained in:
parent
166272e12c
commit
4b707aa9d1
@ -107,11 +107,11 @@ class ServerPermsController:
|
||||
)
|
||||
|
||||
for server in authorized_servers:
|
||||
latest = HelperServerStats.get_latest_server_stats(server.get("server_id"))
|
||||
latest = HelperServerStats.get_server_stats_by_id(server.get("server_id"))
|
||||
server_data.append(
|
||||
{
|
||||
"server_data": server,
|
||||
"stats": DatabaseShortcuts.return_rows(latest)[0],
|
||||
"stats": latest,
|
||||
}
|
||||
)
|
||||
return server_data
|
||||
|
@ -153,7 +153,7 @@ class ServersController:
|
||||
)
|
||||
|
||||
for server in authorized_servers:
|
||||
latest = HelperServerStats.get_latest_server_stats(server.get("server_id"))
|
||||
latest = HelperServerStats.get_server_stats_by_id(server.get("server_id"))
|
||||
key_permissions = PermissionsServers.get_api_key_permissions_list(
|
||||
api_key, server.get("server_id")
|
||||
)
|
||||
@ -164,7 +164,7 @@ class ServersController:
|
||||
server_data.append(
|
||||
{
|
||||
"server_data": server,
|
||||
"stats": DatabaseShortcuts.return_rows(latest)[0],
|
||||
"stats": latest,
|
||||
"user_command_permission": user_command_permission,
|
||||
}
|
||||
)
|
||||
@ -176,7 +176,7 @@ class ServersController:
|
||||
authorized_servers = ServersController.get_authorized_servers(user_id)
|
||||
|
||||
for server in authorized_servers:
|
||||
latest = HelperServerStats.get_latest_server_stats(server.get("server_id"))
|
||||
latest = HelperServerStats.get_server_stats_by_id(server.get("server_id"))
|
||||
# TODO
|
||||
user_permissions = PermissionsServers.get_user_id_permissions_list(
|
||||
user_id, server.get("server_id")
|
||||
@ -188,7 +188,7 @@ class ServersController:
|
||||
server_data.append(
|
||||
{
|
||||
"server_data": server,
|
||||
"stats": DatabaseShortcuts.return_rows(latest)[0],
|
||||
"stats": latest,
|
||||
"user_command_permission": user_command_permission,
|
||||
}
|
||||
)
|
||||
|
@ -1,5 +1,4 @@
|
||||
import logging
|
||||
from playhouse.shortcuts import model_to_dict
|
||||
from app.classes.models.server_stats import HelperServerStats
|
||||
from app.classes.web.base_api_handler import BaseApiHandler
|
||||
|
||||
@ -21,8 +20,6 @@ class ApiServersServerStatsHandler(BaseApiHandler):
|
||||
200,
|
||||
{
|
||||
"status": "ok",
|
||||
"data": model_to_dict(
|
||||
HelperServerStats.get_latest_server_stats(server_id)[0]
|
||||
),
|
||||
"data": HelperServerStats.get_server_stats_by_id(server_id),
|
||||
},
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user