Skip to content

[$40] Fix total when fallback to DB in search requests #337

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

Closed
maxceem opened this issue Jun 11, 2021 · 4 comments
Closed

[$40] Fix total when fallback to DB in search requests #337

maxceem opened this issue Jun 11, 2021 · 4 comments
Labels
PAID Paid manually without TCX

Comments

@maxceem
Copy link
Contributor

maxceem commented Jun 11, 2021

At the moment if search requst fallbacks to DB, the total is calculated in a wrong way, it only returns the number of objects for the current page. While it has to return the number of objects in total for all the pages.

Previously we fixed this issue for GET /resourceBookings see https://github.com/topcoder-platform/taas-apis/blob/dev/src/services/ResourceBookingService.js#L649-L656

We have to fix search requests for other endpoints:

  • GET /work-periods

  • GET /work-period-payments

  • GET /jobs

  • GET /jobCandidates

  • GET /jobCandidates/:jobCandidateId/interviews

  • GET /taas-roles

  • To make it easier to see from where we get data DB or ES, update function setResHeaders https://github.com/topcoder-platform/taas-apis/blob/dev/src/common/helper.js#L787-L813 to also set one more header X-Data-Source with values database or elasticsearch. Note, that we already pass flag result.fromDb to this method.

  • Provide verifications screens that show that for each of these requests, the total returned from ES is the same when returned from DB.

  • To test request from DB, the ES service could be stopped docker stop tc-taas-elasticsearch.

@maxceem maxceem changed the title Fix total when fallback to DB in search requests [$40] Fix total when fallback to DB in search requests Jun 11, 2021
@xxcxy
Copy link
Contributor

xxcxy commented Jun 11, 2021

GET /taas-roles
This api does not support paging.

@maxceem
Copy link
Contributor Author

maxceem commented Jun 11, 2021

GET /taas-roles
This api does not support paging.

I see, then no need to fix it for this endpoint.

maxceem added a commit that referenced this issue Jun 14, 2021
@maxceem maxceem reopened this Jun 14, 2021
@maxceem
Copy link
Contributor Author

maxceem commented Jun 14, 2021

@maxceem
Copy link
Contributor Author

maxceem commented Jun 16, 2021

This is not possible to test via QA, but verification screenshots were provided in PR #341.

Closing.

@maxceem maxceem closed this as completed Jun 16, 2021
@maxceem maxceem added the PAID Paid manually without TCX label Jun 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PAID Paid manually without TCX
Projects
None yet
Development

No branches or pull requests

2 participants