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

Fix secondary sort error in cube comparisons #2443

Merged
merged 1 commit into from
Jan 20, 2024

Conversation

lunakv
Copy link
Contributor

@lunakv lunakv commented Jan 20, 2024

Fixes #2436.

Issue

The error was caused by the getLabels function being incorrectly passed a whole column instead of an array of cards.

For example, if the primary sort was Color Category and the secondary sort was Guilds, the columns object would end up looking like:

{
    "White": { 
        "Azorius": [...],
        "Boros": [...],
        ...
    },
    "Blue": { ...}
    ...
}

And then the column variable takes on the individual values of that, each of which is an object with guild names as keys (e.g. {"Azorius": [...], "Boros": [...], ...}). Because the getLabels function expects an array of cards and instead got this object, it caused errors, most notably because objects are not iterable and some sort options require iterating over the passed cards.

This also explains why only some tags were affected. Options such as Mana Value only return a predetermined set of labels, so only those options that actually need the list of cards (such as Tags) cause a crash.

Fix

Change the call so that the column is flattened into a simple array of all the cards within it.

@lunakv
Copy link
Contributor Author

lunakv commented Jan 20, 2024

Oh, and I found another bug while debugging this, which I wrote up into #2442

@dekkerglen dekkerglen merged commit 6b78745 into dekkerglen:master Jan 20, 2024
1 check failed
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.

Error when using cube comparison secondary sort
2 participants