Register
Submit a solution
The challenge is finished.

Challenge Overview

Challenge Objectives

  • To update the leaderboard processor to store the groupId of a contest and to use the leaderboard api to interact with the database

  • To update the leaderboard api with new endpoints that allow updates to the database

  • To update the leaderboard api to support a new query filter for GET requests

  • Update / Provide tests

 

Project Background

  • Leaderboard processor app is meant for use during Topcoder Events, such as TCO, to prepare the leaderboard rankings based on the reviews of submissions made specifically for these events

  • Leaderboard api is meant to facilitate interaction with the database to store the leaderboard details

 

Technology Stack

  • Nodejs (version 8)

  • Mongodb

  • Kafka

 

Code access

For the leaderboard processor, you can find the code here. For the leaderboard api, you can find the code here. Make sure you use the develop branch for both repositories

 

Individual requirements

Update the leaderboard API (Major Requirement)

  • There is only one route in the api: to read the leaderboard. Update the api to support three additional endpoints: One to write data into the leaderboard (POST request), another to update the data in the leaderboard (PATCH request) and finally one to remove the data in the leaderboard (DELETE request)

  • Update the leaderboard model to store a “groupId” field of type String. An example of a groupId for your reference can be found here.

  • Update the existing GET request to support an additional filter “groupId”. If the query contains this filter, then you will need to carry out the following in the request handler:

    • Prevent challengeId also being part of the same filter (either groupId or challengeId needs to be provided, but not both)

    • Get the requested data from database using the filters provided

    • Group the data by the member ids. Thus, each member will have the data about the scores for each contest that they submitted to (in this scenario, they would be contests belonging to the same group)

    • For each member, get the aggregate of the aggregate scores and make a note of the # of records against each member. Refer to this # as “numberOfChallenges”

    • Also, for each member, add the total tests passed and the total tests.

    • Respond back with:

      • the final aggregation score,

      • the total tests

      • the total tests passed

      • the member handle and memberId

details for each member in the query

    • also respond back with the # of challenges against each member (the number of records for each member after grouping)

  • (Minor Requirement) Also, for the GET query, use perPage and page query parameters instead of skip and limit for pagination

 

Update the leaderboard processor (Major Requirement)

  • Currently, the processor directly interacts with the database.

  • Instead, update the processor to use the new endpoints that will be created in the leaderboard api as part of this contest

  • You need to remove obsolete code (files such as the model) in the process.

 

Update / Provide tests

  • For both the leaderboard processor and leaderboard api, you need to provide unit and e2e tests with a code coverage exceeding 80%.

  • You need to use nock / sinon to mock and mocha and chai for the tests.

  • Note that the leaderboard api does not have any tests at all. You will be writing them.

 

Deployment guide and validation document

Update the deployment guide of both processor and api as needed for this contest.

 

Important Notes

  • Follow existing conventions used in both the apps

  • Ensure there are no lint errors during submission

  • You need to update the POSTMAN collection of the leaderboard api (Minor Requirement)



Final Submission Guidelines

You can submit a git patch for both leaderboard processor and api that contain your changes.

 

ELIGIBLE EVENTS:

2020 Topcoder(R) Open

Review style

Final Review

Community Review Board

Approval

User Sign-Off

ID: 30104644