Chapter 3: Ticket: Paging

I have a similar error to Omar Faruk where the Method and Unit Tests pass but the integration tests fail.
I get the below error.
“Paging: Did not receive the proper response when paging by genre.”
I tried adding the sort method to the return with a .Sort(sort) as hinted at in the other thread but I still have the same error.

Any help would be appreciated.

Sending you a message to share the code.

Kanika

Old post, but I spent some hours trying to figure out the cause of the error, first, I added a try-catch block to actually see the error, then I saw that my unit tests were passing maybe it was the sorting method, so I looked on the other methods and noticed that the DefaultSortOrder where being converted to a Bson document and I did it the exact same way, and it worked!

Old post, but same issue. I haven’t yet managed to found a solution. Some ideas?

Ok, i have found an answer: the errors (Chapter 3, ticket Paging) where two:

  1. Paging: Did not receive the proper response when paging by genre
  2. Paging: Did not receive the proper response when paging by text

For the first one, review the method GetMoviesByGenreAsync and fix the order of calls (find, sort, limit, skip…)

The second, is a weird thing. If you have the second one, the first is good.
The second one call another method: GetMoviesByTextAsync. Is already written and is ok.
The weird thing is the results are not always the same, and i have passed the ticket only for chance.

Further informations in private, don’t want to share solution in public.
Maybe i will open an issue.

1 Like

I’m passing this test on the status screen around 20% of the time with no changes to the code. My answer matches the detailed answer but still getting unreliable results. It also seems to be manifesting on the application itself where ability to scroll is inconsistent. Can anyone explain what is going on and please point to specific lines of code and not generalities. ty

Is the order by the score (of the text search) of the documents. There are multiple documents with the same score, so the results are random. Add another field to the sort order to have stable results. But i don’t know if the test will pass.

1 Like

GetMoviesByGenreAsync in MovieController.cs puts a ‘0’ page size into MovieResponse. Change that to ‘page’ so it can pass the page size through properly.
MovieResponse should probably have a default page size of 0. Perhaps they require a page input to make this an intentional (but soluble) debug exercise. In that case, this post may not last…

3 Likes

I am new at this, and I am stock in the Chapter 3: User-Facing Backend Ticket: Paging.
I am getting the infamous “Paging: Did not receive the proper response when paging by text” at the status page. Method “GetMoviesByTextAsync” is something I have not modified, I changed the MovieController based on teh recommendation, but it is still not working. Unit testing is passing for TestMoviesByKeyword and TesMoviesByGenre. Do you have any additional suggestions please? any assistance will be greatly appreciated.

You are not alone! There isn’t a final answer. There are many items with the same text score, so the return value is random. Short answer: keep retrying. Long answer: find the test in javascript client with developer tools of your browser to get a clue on the query. Good luck!

I have just open the M220N application to retake the test. Now is stable and the validation is ok. :thinking:
Anyway, to get more clues, open devtools on your browser and find the text “Did not receive the proper response when paging by text” to view the query. Then make a new test on c# side.
Another thing: first try to restore the original mflix database.

Vicenzo,

Thank you for your response, definitely a puzzle here. So I ended correcting the page entry movie controller, then I put debugging points at the GetMoviesByTextAsync and GetMoviesByGenreAsync to understand what is happening. I ran it once and still did not work. I ran it twice going slower, checking several elements in the execution, and to my surprise it worked now, being able to obtain the code. Very strange, I wonder if thee is a latency in the communication with Atlas.

Kind regards

Hello. I read the ticket “Paging”. Are you sure that the test TestReturnsMoviesByDefaults checks implemenation of paginating in TestGetMoviesByGenre? Actually, I am not. If you are too, please, add one more test for the method TestGetMoviesByGenre(). It must look like TestReturnsMoviesByDefaults(). Or, maybe, there are more sophistikated solution.

Same problem here guys!
The test made up in the front-end appearly does not match the actual registers on the DB.

Hi @Victor_Naito, welcome to the community.
May be the following discussion can help you:

In case you have any doubts, please feel free to reach out to us.

Thanks and Regards.
Sourabh Bagrecha,
Curriculum Services Engineer

Any help would be appreciated. :grinning: ,I meet the same problems.

Hi @111442, welcome to the community.
Can you post a screenshot of the error you are getting?
Also, please check out this discussion, if you haven’t already:

In case you have any doubts, please feel free to reach out to us.

Thanks and Regards.
Sourabh Bagrecha,
Curriculum Services Engineer

Thank you. This solved it for me!

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