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

Refactor unique method to use exists without empty string #303

Merged
merged 1 commit into from
Sep 8, 2024

Conversation

gravetii
Copy link
Contributor

@gravetii gravetii commented Sep 8, 2024

No description provided.

@lenguyenthanh lenguyenthanh merged commit 5f292da into lichess-org:master Sep 8, 2024
3 checks passed
@lenguyenthanh
Copy link
Member

this is much better, thanks!

@gravetii gravetii deleted the refactor-unique-method branch September 8, 2024 05:39
@@ -32,8 +32,7 @@ extension [A](changes: List[ChangeStreamDocument[A]])
def unique: List[ChangeStreamDocument[A]] =
changes
.foldRight(List.empty[ChangeStreamDocument[A]] -> Set.empty) { case (change, p @ (acc, ids)) =>
val id = change.docId.getOrElse("")
if !ids.contains(id) && id != ""
if change.docId.exists(ids.contains)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

hi @lenguyenthanh this should actually be if change.docId.exists(!ids.contains)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pushed the patch here - #308

gravetii added a commit to gravetii/lila-search that referenced this pull request Sep 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.

2 participants