Skip to content
This repository has been archived by the owner on May 6, 2022. It is now read-only.

Update challenge filters and sorting #201

Merged
merged 10 commits into from
Dec 9, 2021
Merged

Update challenge filters and sorting #201

merged 10 commits into from
Dec 9, 2021

Conversation

tschaffter
Copy link
Member

@tschaffter tschaffter commented Nov 25, 2021

Implements recent changes made to the schemas on challenge filtering and sorting. This PR also implements the changes suggested in this PR.

Swagger UI tips

Example of selecting multiple values in Swagger UI. Unfortunately, it's not possible to deselect the items. Selecting -- will result in the select of an empty value, which in this example, will trigger an error because an empty string is not a valid challenge status. A solution is to refresh the Swagger UI page.

image

Filtering

  • Filtering by topics keeps the challenges that have at least one topic specified
  • Filtering by status keeps the challenges that have their status equal to one of the status values specified
  • Filtering by platformId keeps the challenges that have their platform id equal to one of the platform ids specified
  • Filtering by difficulty keeps the challenges that have their difficulty level set to one of the values specified
  • Filtering by inputDataTypes keeps the challenges that have at least one of the input data types specified
  • Filtering by submissionTypes keeps the challenges that have at least one of the submission types specified
  • Filtering by incentiveTypes keeps the challenges that have at least one of the incentive types specified
  • Filtering by starDateRange (object) keeps the challenges that have their start date inside the date range specified
  • Filtering by orgIds keeps the challenges organized by the orgs specified
    • The current solution keeps the challenges that have their ownerId included in the list orgIds specified.
    • An alternative solution would have been to check that Challenge.fullName starts with one of the org logins specified. For now I preferred during the comparison with org ids instead of org logins because it's more consistent with other filters (e.g. search by platform ids) and is easier to implement.
  • Filtering by organizerIds keeps the challenges organized by the organizers specified (organizer must be a User)
    • Save for another PR (see note below)
  • Filtering by sponsorIds keeps the challenges organized by the sponsors specified (sponsor must be an Organization)
    • Save for another PR (see note below)

Filtering by organizers and sponsors

The filtering could be done using ids or name. The former would results in a better user experience and contributes to reduce the issue of of homonyms by showing to the user additional information about the selected organizers or sponsors like their picture, affiliation for the organizers, etc. One potential drawback is that the organizers and sponsors must have User or Org account in the registry. If the registry is widely adopted by the community, this limitation would decrease as the number of User and Org account increases. This first approach could also be an incentive to organizers and sponsors to create an account.

The second solution is for the user to type a name and for the registry to then show a list of matching names from the list of all challenge organizers, for instance. Because an organizer who organize two challenges would appear twice in this list, the filter behavior would only make sense if we show the user a list of unique names (i.e. aggregate identical name). Therefore the organizer options shown to the user are "string" in this second approach, while their were "User" in the first approach. The "string" has less information than a "User" object and so it would not be possible (or rather difficult) to show information about organizer affiliation, avatar, etc. The benefit of this solution is that it enables to search organizers or sponsors that have not created account in the registry.

Sorting

  • Sorting by featured - desc displays the featured challenges first
  • Sorting by startDate - desc displays the challenges starting from the one that start last
  • Sorting by participantCount - desc displays the challenges starting from the one with the largest participant count
  • Sorting by viewCount - desc displays the challenges starting from the one with the largest view count
  • Sorting by starredCount - desc displays the challenges starting from the one that has been starred the most
    • Either sync starredCount with the content of the collection starred_challenge OR rely only on the collection starred_challenge
  • Sorting by name - desc displays the challenges in alphabetical order by their name
  • Sorting by createdAt -desc displays the challenges starting from the one created the most recently
  • Sorting by updatedAt - desc displays the challenges starting from the one updated the most recently

@tschaffter tschaffter requested a review from rrchai November 26, 2021 17:09
@tschaffter
Copy link
Member Author

tschaffter commented Nov 26, 2021

@rrchai This PR should allow us to implement all the challenge filters and sorting strategies that we have identified. The exceptions are filtering by organizers and sponsors (see note above).

The next steps are:

  • Review this PR of the rocc-db-client that I prepared to push new challenge information related to filtering and sorting.
  • Update the production seed to include the information about the additional Challenge parameters added in the above PR.
  • Checkout this branch of the API, use rocc-db-client and the new seed to seed the database.
  • Manually test this PR using Swagger UI
  • Update the client library for Angular

@tschaffter tschaffter merged commit 1047b54 into main Dec 9, 2021
@tschaffter tschaffter deleted the add-challenge-sort branch December 9, 2021 05:05
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants