[$40] Fix total
when fallback to DB in search requests
#337
Labels
PAID
Paid manually without TCX
Milestone
Uh oh!
There was an error while loading. Please reload this page.
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-L656We 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 headerX-Data-Source
with valuesdatabase
orelasticsearch
. Note, that we already pass flagresult.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
.The text was updated successfully, but these errors were encountered: