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

Losses vs the AI or anonymous players show up under the Draws tab #3815

Open
cyanfish opened this issue Nov 21, 2017 · 2 comments · May be fixed by #13563
Open

Losses vs the AI or anonymous players show up under the Draws tab #3815

cyanfish opened this issue Nov 21, 2017 · 2 comments · May be fixed by #13563
Labels

Comments

@cyanfish
Copy link
Member

It looks like the counts in the tab titles are correct but the contents of the tabs are not.

See:
https://lichess.org/@/Gary_Internet/draw
https://lichess.org/@/Gary_Internet/loss
https://lichess.org/forum/lichess-feedback/i-cant-filter-on-the-game-ive-lost-when-looking-at-my-profile

@niklasf niklasf added the bug label Nov 21, 2017
@ornicar
Copy link
Collaborator

ornicar commented Nov 23, 2017

it's because the DB selection for draws is

def draw(u: String): Bdoc = user(u) ++ finished ++ F.winnerId.$exists(false) and the AI has no winnerId

There's no fixing it without adding a new index on the games collection, which is very expensive

@cyanfish
Copy link
Member Author

Since loser was added to advanced search, does the needed index exist now? e.g. winner != user && loser != user

thomas-daniels added a commit to thomas-daniels/lila that referenced this issue Sep 5, 2018
Fixes lichess-org#3815.

To remove the AI games from the 'Draws' tab, we can use the winnerColor field instead of the winnerId field - the latter does not exist on AI games, but the former does. So only games without winnerColor are definitely drawn.

To make them show up under losses, we use the fact that games must be lost if winnerColor exists but winnerId not - this only happens if you lose against the AI (if you draw against the ID, winnerColor won't exist; if you win against the ID or play against humans, winnerId will exist).
@niklasf niklasf changed the title Losses vs the AI show up under the Draws tab Losses vs the AI or anonymous players show up under the Draws tab Dec 4, 2019
@niklasf niklasf added this to the Search v2 milestone Jun 5, 2020
@ornicar ornicar removed this from the Search v2 milestone Jun 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants