Closed iamhectorotero closed 2 years ago
Oh, nice find. I didn't expect that bug to go this deep.
It probably should do this even when play
isn't empty, no? So that it finds the correct opening when the FEN is still a known opening but all the moves afterwards not.
That's actually a good point, @benediktwerner. What do you think @niklasf?
I created a new PR (https://github.com/lichess-org/lila-openingexplorer/pull/169) in case you want to merge it
As indicated in https://github.com/lichess-org/lila/issues/11025, when working FromPosition the Opening Explorer doesn't show the opening name even if the position specified is a known one.
The problem happens because the response the frontend gets from the internal endpoint (https://explorer.lichess.ovh/masters) doesn't contain the opening itself, even though according to the API docs it should if the FEN matches a known opening.
I have traced the issue to here and seen that if the endpoint receives an empty play parameter, it won't try to match the position to an opening and just return None. Therefore, I've added this couple of lines to try to match the position to an opening if the play parameter is empty.