Ticket: Paging issue (tests pass, mflix status page error)

Greetings!
Chapter 2 Ticket: Paging, on JavaScript.
jest tests all pass, and I am positive about my code.
but mflix status page, gives:
Paging: Did not receive the proper response when paging by genre
the test:

the console on running and clicking the “click to begin validation” button :

to be noted, I did check the mflix homepage and infinite scrolling on movies works normally as it should.

also here is my code for // TODO Ticket: Paging on static async getMovies() function:

what am I missing? I appreciate any answer. Thanks!

I am not.

I think that all pages must have the same number of moviesPerPage so it means that the limit() should be the same no matter what is the value of page.

As for the skip() it looks like for page==2 you skip the same amount as page==1 which is wrong.

2 Likes

@ppsimn123

Your solution seems complicated? So I assuming I am missing something.

So with 50 documents

skip(Page No. 0 * 20 = 0).limit(Page Size 20) = gets 1 - 20
skip(Page No. 1 * 20 = 20).limit(Page Size 20) = gets 21 - 40
skip(Page No. 2 * 20 = 40).limit(Page size 20) = gets 51 - 60

3 Likes

Welcome @ppsimn123 ! Glad you got the solution you were looking for.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.