Coder Social home page Coder Social logo

Comments (11)

maxceem avatar maxceem commented on August 21, 2024

I've got why to filter there. It's because we use this code for getting a list of projects, not only for getting one project.

We can think what would be a good fix there.

from taas-apis.

nkumar-topcoder avatar nkumar-topcoder commented on August 21, 2024

@maxceem good catch, we need to discuss

from taas-apis.

maxceem avatar maxceem commented on August 21, 2024

So the issue here is because we are calling searchResourceBookings(criteria) which returns 20 results per page by default. As we calling this method without specifying the project id, we are getting more resources for all the projects, which is more than 20. But as we get only the 1st page, we get some random set of resources.

First of all, this method should support filtering by multiple project ids, so we can get resources only for some projects which we are showing on the main page of taas app, not all projects as we do now.

The second task is to get all of the resources for the selected projects, not only 20.

We could set some big perPage value when calling searchResourceBookings(criteria), but potentially we may want to limit the maximum perPage in our API, which would break it again.

So instead of increasing perPage which can get broken, we may add some extra argument for searchResourceBookings(criteria) like internallyReturnAll searchResourceBookings(criteria, internallyReturnAll). Which would force the method to return all the records and ignoring perPage (don't set it for requests from ES and DB).

from taas-apis.

maxceem avatar maxceem commented on August 21, 2024

@imcaizheng feel free to pick this up if you like.

If you have any better ideas on how to fix this issue, please let me know.

from taas-apis.

imcaizheng avatar imcaizheng commented on August 21, 2024

@maxceem How about directly querying DB for resources instead of invoking searchResourceBookings(criteria)? I think it is more common to retrieve data internally inside a service.

from taas-apis.

maxceem avatar maxceem commented on August 21, 2024

Thanks, @imcaizheng, I forgot to consider such an option. Though it also has its disadvantage - we would mix data from ES and from DB. I'm not sure if it could lead to real issues and data inconsistency, but it feels like not the right thing to do. Also, I've noticed that in the TaaS API we always get data from ES so far (with DB fallback). The same I can see in Challenge API https://github.com/topcoder-platform/challenge-api/blob/develop/src/services/ChallengeService.js#L18-L20.

So let's adapt the method searchResourceBookings which gets data from ES, so we can reuse it for our needs.

from taas-apis.

imcaizheng avatar imcaizheng commented on August 21, 2024

@maxceem Agreed.

from taas-apis.

imcaizheng avatar imcaizheng commented on August 21, 2024

PR created #56

from taas-apis.

maxceem avatar maxceem commented on August 21, 2024

Contest https://www.topcoder.com/challenges/30158247 has been created for this ticket.

This is an automated message for maxceem via Topcoder X

from taas-apis.

maxceem avatar maxceem commented on August 21, 2024

Contest https://www.topcoder.com/challenges/30158247 has been updated - it has been assigned to aaron2017.

This is an automated message for maxceem via Topcoder X

from taas-apis.

maxceem avatar maxceem commented on August 21, 2024

Payment task has been updated: https://software.topcoder.com/review/actions/ViewProjectDetails?pid=30158247

This is an automated message for maxceem via Topcoder X

from taas-apis.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.