Skip to content

Commit

Permalink
Fix logs for loser picks
Browse files Browse the repository at this point in the history
More fixes
  • Loading branch information
jauggy committed Oct 1, 2024
1 parent 205834f commit 505925a
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions lib/teiserver/battle/libs/balance_lib.ex
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,8 @@ defmodule Teiserver.Battle.BalanceLib do
end)

names =
group.members
|> Enum.map_join(", ", fn userid -> Account.get_username_by_id(userid) || userid end)
group.names
|> Enum.join(", ")

pairing_logs = [
"Unable to find a combination match for group of #{names} (stats: #{Enum.sum(group.ratings) |> round(2)}, #{group_mean |> round(2)}, #{group_stddev |> round(2)}), treating them as solo players"
Expand All @@ -403,8 +403,8 @@ defmodule Teiserver.Battle.BalanceLib do
end)

names =
group.members
|> Enum.map_join(", ", fn userid -> Account.get_username_by_id(userid) || userid end)
group.names
|> Enum.join(", ")

pairing_logs = [
"Unable to find a player match for group of #{names} (stats: #{Enum.sum(group.ratings) |> round(2)}, #{group_mean |> round(2)}, #{group_stddev |> round(2)}), treating them as solo players"
Expand Down Expand Up @@ -437,8 +437,8 @@ defmodule Teiserver.Battle.BalanceLib do
[group | found_groups]
|> Enum.map(fn fgroup ->
fgroup_name =
fgroup.members
|> Enum.map_join(", ", fn userid -> Account.get_username_by_id(userid) || userid end)
fgroup.names
|> Enum.join(", ")

fgroup_mean = Enum.sum(fgroup.ratings) / Enum.count(fgroup.ratings)
fgroup_stddev = Statistics.stdev(fgroup.ratings)
Expand Down Expand Up @@ -868,12 +868,14 @@ defmodule Teiserver.Battle.BalanceLib do

# Now turn a list of groups into one group
selected_group
|> Enum.reduce(%{members: [], ratings: [], count: 0, group_rating: 0}, fn solo, acc ->
|> Enum.reduce(%{members: [], ratings: [], count: 0, group_rating: 0, names: []}, fn solo,
acc ->
%{
members: acc.members ++ solo.members,
ratings: acc.ratings ++ solo.ratings,
count: acc.count + solo.count,
group_rating: acc.group_rating + solo.group_rating
group_rating: acc.group_rating + solo.group_rating,
names: acc.names ++ solo.names
}
end)
end
Expand Down

0 comments on commit 505925a

Please sign in to comment.