Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated: Add balance mode split one chevs (Updated) #248

Closed
wants to merge 15 commits into from

Conversation

jauggy
Copy link
Contributor

@jauggy jauggy commented Apr 9, 2024

Fixes #218
See issue ticket for details and test instructions.

Incorporating changes suggested by geekingfrog from previous PR.

Dependency to Account module has been removed from the split one chevs balance algorithm. However, inside balancer_server there is a function that iterates over user ids and fetches user information. Previously this information was only rating. Now it includes name and rank. While in code this looks like a db call, it wouldn't be in production because it uses a cache after the data is fetched once. It would be fetched once during login.

loser_picks (written by Teifion) still has a dependency to Teiserver.Account and the reason why units tests pass is because Teifion is using

  use Teiserver.DataCase, async: true

which I think sets up a connection to the database during the test. I am not confident to change this module but can raise a ticket if needed. But as stated earlier, in production it would be using the cache not a db call.

@jauggy jauggy changed the title Add balance mode split one chevs Add balance mode split one chevs (Updated) Apr 9, 2024
@@ -213,17 +213,14 @@ defmodule Teiserver.Game.BalancerServer do
|> Enum.map(fn userid ->
%{
userid =>
BalanceLib.get_user_balance_rating_value(userid, rating_type)
|> fuzz_rating(opts[:fuzz_multiplier])
BalanceLib.get_user_rating_rank(userid, rating_type, opts[:fuzz_multiplier])
}
Copy link
Contributor Author

@jauggy jauggy Apr 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So before it would iterate and call another function per user to get the rating. I thought it was ok because it uses a cache. I'm doing the same thing but now adding on rank and name, which is also cached.

If you can think of a better a solution...

@jauggy jauggy changed the title Add balance mode split one chevs (Updated) Deprecated: Add balance mode split one chevs (Updated) Apr 9, 2024
@jauggy
Copy link
Contributor Author

jauggy commented Apr 9, 2024

As requested I've moved the changes to the other PR

@jauggy jauggy closed this Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add balancemode to evenly distribute one chevs
1 participant