From 174f657661d593612b9cf292b75c35eb34a24001 Mon Sep 17 00:00:00 2001 From: Joshua Augustinus Date: Sat, 15 Jun 2024 21:48:43 +1000 Subject: [PATCH 1/2] Improve whoami and whois --- lib/teiserver/coordinator/coordinator_commands.ex | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/teiserver/coordinator/coordinator_commands.ex b/lib/teiserver/coordinator/coordinator_commands.ex index 6f7bea777..14cb3ca14 100644 --- a/lib/teiserver/coordinator/coordinator_commands.ex +++ b/lib/teiserver/coordinator/coordinator_commands.ex @@ -145,9 +145,12 @@ defmodule Teiserver.Coordinator.CoordinatorCommands do sender = CacheUser.get_user_by_id(senderid) stats = Account.get_user_stat_data(senderid) - total_hours = (Map.get(stats, "total_minutes", 0) / 60) |> round - player_hours = (Map.get(stats, "player_minutes", 0) / 60) |> round - spectator_hours = (Map.get(stats, "spectator_minutes", 0) / 60) |> round + # Hours should be rounded down to make it more + # accurate for determining if a chevron threshold is reached + total_hours = (Map.get(stats, "total_minutes", 0) / 60) |> trunc + player_hours = (Map.get(stats, "player_minutes", 0) / 60) |> trunc + spectator_hours = (Map.get(stats, "spectator_minutes", 0) / 60) |> trunc + lobby_hours = (Map.get(stats, "lobby_minutes", 0) / 60) |> trunc host = Application.get_env(:teiserver, TeiserverWeb.Endpoint)[:url][:host] profile_link = "https://#{host}/profile/#{senderid}" @@ -197,7 +200,7 @@ defmodule Teiserver.Coordinator.CoordinatorCommands do [ @splitter, "You are #{sender.name}", - "Playtime: #{total_hours} hours (#{player_hours} h playing, #{spectator_hours} h spectating)", + "#{total_hours} total hours (#{player_hours} h playing, #{spectator_hours} h spectating, #{lobby_hours} h in lobby)", "Profile link: #{profile_link}", "Skill ratings:", ratings, @@ -275,11 +278,14 @@ defmodule Teiserver.Coordinator.CoordinatorCommands do end) |> Enum.sort() + chevron_level = Map.get(stats, "rank", 0) + 1 + standard_parts = [ @splitter, "Found #{user.name}", if(previous_names != "", do: "Previous names: #{previous_names}"), "Profile link: #{profile_link}", + "Chevron level: #{chevron_level}", ["Ratings:" | ratings], moderation_data, @splitter From c8fc827ca8f0a2df3aded8f97a6546ff56a59443 Mon Sep 17 00:00:00 2001 From: Joshua Augustinus Date: Sat, 29 Jun 2024 05:29:14 +1000 Subject: [PATCH 2/2] Update based on Lexon feedback --- lib/teiserver/coordinator/coordinator_commands.ex | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/teiserver/coordinator/coordinator_commands.ex b/lib/teiserver/coordinator/coordinator_commands.ex index 14cb3ca14..d00096e0a 100644 --- a/lib/teiserver/coordinator/coordinator_commands.ex +++ b/lib/teiserver/coordinator/coordinator_commands.ex @@ -196,12 +196,15 @@ defmodule Teiserver.Coordinator.CoordinatorCommands do end) |> Enum.sort() + chevron_level = Map.get(stats, "rank", 0) + 1 + msg = [ @splitter, "You are #{sender.name}", "#{total_hours} total hours (#{player_hours} h playing, #{spectator_hours} h spectating, #{lobby_hours} h in lobby)", "Profile link: #{profile_link}", + "Chevron level: #{chevron_level}", "Skill ratings:", ratings, accolades_string