Chapter 2: User-Facing Backend Ticket: Paging

Hi, I’ve implemented the ticket in the MovieDao and run the tests OK.
I have tested the scrolling in the UI and it seems OK.
But the status page show an error: Paging:

Did not receive the proper response when paging by cast

Did I forget something?

Thanks

Hello Carlos. I’m experiencing the same problem, tests did run correctly but validation didn’t. In my case infinite scroll is not working in home page, instead of that I see two scrollbars in the right part of the window.

I continued searching in the forum and found this post which says this error is automagically solved after completing the ticket User preferences. I didn’t do it yet, so we have to continue with the course and try at that point.

I passed the User preferences, but the Paging Ticket is not yet passing.
It seems it might be other issue with duplicate in database with user collection.

Please share the pipeline.

Kanika

This is the code I’ve implemented:
public List getMoviesByGenre(String sortKey, int limit, int skip, String… genres) {
// query filter
Bson castFilter = Filters.in(“genres”, genres);
// sort key
Bson sort = Sorts.descending(sortKey);
List movies = new ArrayList<>();
// TODO > Ticket: Paging - implement the necessary cursor methods to support simple
// pagination like skip and limit in the code below
moviesCollection.find(castFilter)
.sort(sort)
.skip(skip)
.limit(limit)
.iterator()
.forEachRemaining(movies::add);
return movies;
}

The pipeline looks good! Please share the console error.

Kanika

No errors are shown in Java console or Devtools Chrome.

What else could I review?

Hi @Carlos_55342,

Please try changing the return type of function from List to List<Document>, here:

public List<Document> getMoviesByGenre(String sortKey, int limit, int skip, String... genres) {
    Bson castFilter = Filters.in("genres", genres);
    Bson sort = Sorts.descending(sortKey);
    List<Document> movies = new ArrayList<>();
    moviesCollection
        .find(castFilter)
        .sort(sort)
        .limit(limit)
        .skip(skip)
        .iterator()
        .forEachRemaining(movies::add);
    return movies;
  }

Kanika

Hi Kanika,
I got the same error, maybe it’s something different.
Can log level be set at higher level?
Sorry I remember I dropped sessions collection hours ago (now it has some data again), could be that an issue?
I am testing with Guest User in Chrome, but same result.

Please find attached a network details screenshot from devtools:

Hi @Carlos_55342,

Please share the console error messages when you run the UI status page to get the validation code for Paging Ticket.

Kanika

Hi Kanika,
there aren’t
Did you mean: Paging: Did not receive the proper response when paging by cast

or
MV5BMjAzNTI0ODUxOF5BMl5BanBnXkFtZTgwNTQxNzQxMTE@.V1_SY1000_SX677_AL.jpg:1 GET https://m.media-amazon.com/images/M/MV5BMjAzNTI0ODUxOF5BMl5BanBnXkFtZTgwNTQxNzQxMTE@.V1_SY1000_SX677_AL.jpg 404
Image (async)
St @ react-dom.production.min.js:1108
Wr @ react-dom.production.min.js:2504
La @ react-dom.production.min.js:4142
di @ react-dom.production.min.js:4581
pi @ react-dom.production.min.js:4622
hi @ react-dom.production.min.js:4639
Yi @ react-dom.production.min.js:4902
$i @ react-dom.production.min.js:4860
qi @ react-dom.production.min.js:4851
nu @ react-dom.production.min.js:5288
Rn @ react-dom.production.min.js:1782

@Kanika I cannot dedicate so much time only for this Ticket.
I must go on with the next chapters.
Do you agree that the ticket is ok?

Hi @Carlos_55342,

This ticket looks great. I’ll give you a credit for it.

Best