diff --git a/webclient/pages/servers.py b/webclient/pages/servers.py index 360d421..3ca9703 100644 --- a/webclient/pages/servers.py +++ b/webclient/pages/servers.py @@ -95,6 +95,9 @@ def _fix_server_info(server): server["info"]["start_date"] = _date_to_string(server["info"]["start_date"]) server["info"]["game_date"] = _date_to_string(server["info"]["game_date"]) + minutes = int(server["info"]["ticks_playing"] / 37 / 60) + server["info"]["time_playing"] = f"{minutes // 60}h {minutes % 60}m" + def _split_version(raw_version): """ diff --git a/webclient/static/css/servers.css b/webclient/static/css/servers.css index 9e36ba5..8fa3186 100644 --- a/webclient/static/css/servers.css +++ b/webclient/static/css/servers.css @@ -54,7 +54,7 @@ width: 15px; } #server-table .name { - width: 562px; + width: 492px; } #server-table .address { width: 100px; @@ -65,6 +65,9 @@ #server-table .companies { width: 70px; } +#server-table .play-time { + width: 70px; +} #server-table .version { width: 120px; } diff --git a/webclient/templates/server_entry.html b/webclient/templates/server_entry.html index 8d8dafe..9c2b3d7 100644 --- a/webclient/templates/server_entry.html +++ b/webclient/templates/server_entry.html @@ -56,36 +56,42 @@

{% block title %}{{ server["info"]["name"] }} {% endblock %}

+ Play time: + + {{ server["info"]["time_playing"] }} + + + Clients: {{ server["info"]["clients_on"] }} / {{ server["info"]["clients_max"] }} - + Companies: {{ server["info"]["companies_on"] }} / {{ server["info"]["companies_max"] }} - + Spectators: {{ server["info"]["spectators_on"] }} - + Landscape: {{ mapsets[server["info"]["map_type"]] }} - + Map size: {{ server["info"]["map_width"] }} x {{ server["info"]["map_height"] }} - + Dedicated server: {% if server["info"]["is_dedicated"] == 1 %} @@ -95,7 +101,7 @@

{% block title %}{{ server["info"]["name"] }} {% endblock %}

{% endif %} - + Gamescript: {% if server["info"]["gamescript_version"] is none %} @@ -108,7 +114,7 @@

{% block title %}{{ server["info"]["name"] }} {% endblock %}

{% if server["info"]["newgrfs"] is not none %} - + NewGRFs in use: {{ server["info"]["newgrfs"]|length }} diff --git a/webclient/templates/server_list.html b/webclient/templates/server_list.html index ad1eef0..3cf8935 100644 --- a/webclient/templates/server_list.html +++ b/webclient/templates/server_list.html @@ -20,6 +20,7 @@

{% block title %} Name Clients Companies + Play time Version @@ -51,6 +52,9 @@

{% block title %} {{ server['info']['companies_on'] }} / {{ server['info']['companies_max'] }} + + {{ server['info']['time_playing'] }} +
{{ server['info']['openttd_version'] }}