SharebookBR / sharebook-backend

Projeto backend de código livre para o app Sharebook.
117 stars 75 forks source link

Não está trazendo nome do ganhador no endpoint paged book list #198

Open raffacabofrio opened 5 years ago

raffacabofrio commented 5 years ago

endpoint: /api/Book/{page}/{items}

Não está trazendo nome do ganhador. Suspeito que seja falta de include.

Talvez esse link ajude: https://stackoverflow.com/questions/10822656/entity-framework-include-multiple-levels-of-properties

bhenn commented 5 years ago
screen shot 2019-01-16 at 12 36 29 pm

Fui testar e retornou pra mim o nome do ganhador

raffacabofrio commented 5 years ago

É estranho. Em alguns casos traz o nome. Em outros não.

Vou fazer o seguinte. Vou olhar no banco e confirmar 3 casos concretos em que NÃO traz. Aí fica melhor de rastrear o problema.

raffacabofrio commented 5 years ago

Seguem os 3 casos em DEV...

ID: 6B276788-8426-41AD-FD2D-08D676AB31CC LIVRO: Teste Winner 10/01 GANHADOR: William +

ID: B666FCB3-E49D-4CBE-FD2E-08D676AB31CC LIVRO: Teste Winner 10/01 - 02 GANHADOR: William +

ID: 0B478F87-E29D-4521-CD76-08D66DAB3B72 LIVRO: valida dev dezembro 29 GANHADOR: RAFFA3

walter-lopes commented 5 years ago

Esse bug ainda persiste ?

raffacabofrio commented 5 years ago

Sim. Eu tentei resolver adicionando alguns includes mas ficou terrivelmente lento e eu nem mandei pr ainda. :-(

Está em aberto ainda. Um pr seria bem vindo. 🙏

Em sáb, 16 de mar de 2019 13:52, Walter Vinicius notifications@github.com escreveu:

Esse bug ainda persiste ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SharebookBR/sharebook-backend/issues/198#issuecomment-473564469, or mute the thread https://github.com/notifications/unsubscribe-auth/AKIUoti1uPvy9LoJhcD53igmIF67CZ3eks5vXSFGgaJpZM4aDTK7 .

rmenezes commented 5 years ago

Tem o código pra análise pra ver onde está o gargalo de performance?

raffacabofrio commented 5 years ago

Salve @rmenezes . Eu não subi o código por conta desse problema de performance. Mas ele seria parecido com esse. Porém sem o filtro por BookId. Se liga só...

public Book GetBookWithAllUsers(Guid bookId) { var books = _repository .Get().Include(x => x.User).ThenInclude(u => u.Address) .Include(x => x.UserFacilitator).ThenInclude(u => u.Address) .Include(x => x.BookUsers).ThenInclude(bu => bu.User).ThenInclude(u => u.Address) .Where(x => x.Id == bookId) .ToList();

        return books.FirstOrDefault();
    }