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

[chapter 5] fix User inPhotos logic #51

Open
dorakemon opened this issue Apr 21, 2022 · 0 comments
Open

[chapter 5] fix User inPhotos logic #51

dorakemon opened this issue Apr 21, 2022 · 0 comments

Comments

@dorakemon
Copy link

I read Japanese edition and found a mistake that is not related to a main topic

The below code is written in a book

    inPhotos: (parent: any) =>
      tags
        .filter((tag) => tag.userID === parent.id)
        .map((tag) => tag.photoID)
        .map((photoID) => photos.find((p) => p.id === photoID))

However correct code is below

    inPhotos: (parent: any) =>
      tags
        // NOT parent.id BUT parent.githubLogin
        .filter((tag) => tag.userID === parent.githubLogin)
        .map((tag) => tag.photoID)
        .map((photoID) => photos.find((p) => p.id === photoID))

tag.userID is githubLogin ("gPlake") NOT id ("1")

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

1 participant