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

Casting mutliple Match() as Matches() strips the rank property from each Match()` #9

Open
ReagentX opened this issue Sep 15, 2017 · 3 comments

Comments

@ReagentX
Copy link

ReagentX commented Sep 15, 2017

match_stats = [[Match([{Player(6667): GaussianRating(25.0, 8.333)}, {Player(4991): GaussianRating(25.0, 8.333)}], rank=[1, 2])], [Match([{Player(6615): GaussianRating(25.0, 8.333)}, {Player(7557): GaussianRating(25.0, 8.333)}], rank=[1, 2])]]

Cast match_stat as Matches():

Matches(match_stats)

This results in:

 [Match([{Player(6667): GaussianRating(25.0, 8.333)}, {Player(4991): GaussianRating(25.0, 8.333)}]), Match([{Player(6615): GaussianRating(25.0, 8.333)}, {Player(7557): GaussianRating(25.0, 8.333)}])]

As a result, using calculator will result in AttributeError: Match does not have a ranking.

@McLeopold
Copy link
Owner

This is your example. You have a list of lists instead of a list of single match objects.

match_stats = [
    [Match([
        {Player(6667): GaussianRating(25.0, 8.333)}, 
        {Player(4991): GaussianRating(25.0, 8.333)}
    ], rank=[1, 2])],
    [Match([
        {Player(6615): GaussianRating(25.0, 8.333)},
        {Player(7557): GaussianRating(25.0, 8.333)}
    ], rank=[1, 2])]
]

Take off the extra brackets around the match objects:

match_stats = [
    Match([
        {Player(6667): GaussianRating(25.0, 8.333)}, 
        {Player(4991): GaussianRating(25.0, 8.333)}
    ], rank=[1, 2]),
    Match([
        {Player(6615): GaussianRating(25.0, 8.333)},
        {Player(7557): GaussianRating(25.0, 8.333)}
    ], rank=[1, 2])
]

I think it is confusing that you got back almost what you expected but without the rank. I'll have to decide if an error should be thrown or not.

@ReagentX
Copy link
Author

ReagentX commented Sep 16, 2017

Thanks for your clarification–not sure how I missed that. I will have to rethink how I am generating the Match objects.

As an aside: does the rank=[1, 2] mean the first item in the match "won" while the second item in the match "lost"? For example, in

match_stats = [
Match([
    {Player(6667): GaussianRating(25.0, 8.333)}, 
    {Player(4991): GaussianRating(25.0, 8.333)}
      ], rank=[1, 2])]

the rank=[1, 2] denotes that Player(6667) beat Player(4991)?

@McLeopold
Copy link
Owner

Yes. It's 2 lists that get matched up by order. Lowest number wins. Remember you can have more than 2 teams.

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

No branches or pull requests

2 participants