Skip to content
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

Support sorting by "GET /resources" endpoint #51

Open
maxceem opened this issue Dec 10, 2020 · 12 comments
Open

Support sorting by "GET /resources" endpoint #51

maxceem opened this issue Dec 10, 2020 · 12 comments

Comments

@maxceem
Copy link
Contributor

maxceem commented Dec 10, 2020

We have a feature request for Admin App to be able to sort challenge resources by:

  • memberHandle
  • created
  • Is it hard to support sorting by role text alphabetically: Registered, Submitter, Observer?

@ThomasKranitsas @rootelement

@rootelement
Copy link
Contributor

Merged this:
#54
@maxceem please test in dev

@maxceem
Copy link
Contributor Author

maxceem commented Dec 21, 2020

@maxceem
Copy link
Contributor Author

maxceem commented Dec 23, 2020

@rootelement "sortBy" is required now, though it feels that it should be optional.
It's also marked as optional in Swagger

image

but in code it's marked as required:

image

@maxceem
Copy link
Contributor Author

maxceem commented Dec 23, 2020

@rootelement now sorting params are optional and sorting by created looks good.
But sorting by memebrHandle doesn't return any results, while the same request without sorting returns data.

For example, request with sorting by memberHandle returns nothing:

curl 'https://api.topcoder-dev.com/v5/resources?challengeId=bcac639d-9d56-458b-bbbf-efc13b1e342a&page=1&perPage=100&sortBy=memberHandle&sortOrder=asc' \
  -H 'authority: api.topcoder-dev.com' \
  -H 'accept: application/json' \
  -H 'access-control-expose-headers: *' \
  -H 'authorization: Bearer <TOKEN>'

while the same request without sorting returns records:

curl 'https://api.topcoder-dev.com/v5/resources?challengeId=bcac639d-9d56-458b-bbbf-efc13b1e342a&page=1&perPage=100' \
  -H 'authority: api.topcoder-dev.com' \
  -H 'accept: application/json' \
  -H 'access-control-expose-headers: *' \
  -H 'authorization: Bearer <TOKEN>'

@maxceem
Copy link
Contributor Author

maxceem commented Dec 25, 2020

@rootelement at the moment no resources are returned by this endpoint even without sorting params for any challenge.

@maxceem
Copy link
Contributor Author

maxceem commented Dec 28, 2020

@ThomasKranitsas at the moment Resouces API doesn't return any resources with or without scoring params. It always returns 0 resources for all the challenges on DEV.

@ThomasKranitsas
Copy link
Contributor

Hey @maxceem, seems like there was a change on the API in order to support sorting but in order for this to work we need to update the mappings in ES and reindex the data. I have temporarily reset this change so the API works again.

cc @rootelement

@maxceem
Copy link
Contributor Author

maxceem commented Dec 29, 2020

Thanks, @ThomasKranitsas. Now Resource API returns data for me as before.

Though I can still reproduce this issue for some challenges.
For example, I've created a new challenge, and assigned a copilot https://challenges.topcoder-dev.com/projects/16668/challenges/92af11c5-df2e-4703-8d32-f4b80a5dc064/edit
When I get the list of resources https://api.topcoder-dev.com/v5/resources?challengeId=92af11c5-df2e-4703-8d32-f4b80a5dc064 I get 0 results. Though I've already created one copilot record.
And if I try to assign a copilot again I get an error that the resource is already there: "User max.admin already has resource with roleId: cfe12b3f-2a24-4639-9d8b-ec86726f76bd in challenge: 92af11c5-df2e-4703-8d32-f4b80a5dc064"

I'm not sure if this is connected with the issue, or should I log a new issue for this.

@ThomasKranitsas
Copy link
Contributor

No, no need for a new issue. Seems like a recent change broke something.. I'll investigate and fix

@rootelement
Copy link
Contributor

@maxceem is this unblocked now? Can you finish the admin in dev?

@maxceem
Copy link
Contributor Author

maxceem commented Jan 12, 2021

@rootelement this is not fixed yet.

When I get resources without sorting it works:

image

But when I apply sorting no results are returned:

image

@ThomasKranitsas
Copy link
Contributor

memberHandle is not yet supported as we need to reindex the existing data.

cc @rootelement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants