EvalAI icon indicating copy to clipboard operation
EvalAI copied to clipboard

[Feature] Prize support for Challenges

Open b9aurav opened this issue 1 year ago • 1 comments

This pull request is for the addition of the challenge prizes feature [fixes #3893]. This feature will allow hosts to offer rewards to the top-performing participants in a challenge.

To add prizes to a challenge:

  1. Define the prizes configuration in the challenge configuration file. The prizes should be specified in the following format:
prizes:
  - rank: 1
    amount: '1000USD'
  - rank: 2
    amount: '500USD'
  - rank: 3
    amount: '100USD'

# It also allows amount in decimal format with any three-letter currency (e.g. '100.50EUR', '10000INR').
  1. The validation will check that the rank values are unique and amount values are formatted correctly.
  2. If the validation passes, the has_prizes attribute in the challenge model will be set to True.
    • The prizes will be displayed in a separate tab section on the challenge details page. Participants will be able to see the rank and prize amount.
  • If host do not want to add prizes to the challenge, simply remove the prizes from challenge configuration file. In this case, the has_prizes attribute will remain False, and the prize tab section will be removed from the challenge details page.

Here's Screenshot of hosted challenge with above 'prizes' configuration:

image

To implement this feature,

  • Added ChallengePrize model and serializer to handle prizes in challenges.
  • Added has_prizes attribute to the Challenge model class.
  • Modified create_or_update_github_challenge method to create and update prize objects from configuration file.
  • Added configuration file validation for direct zip upload.
  • Added config value validation to ensure appropriate values in challenge configuration.
  • Added get_prizes_by_challenge method and URL to retrieve prize objects via API call.
  • Added API Call to get prize data of a challenge in the backend.
  • Added frontend page route and display file for the Prize section.

b9aurav avatar Mar 25 '23 15:03 b9aurav

Codecov Report

Merging #3906 (a0f23e0) into master (96968d6) will decrease coverage by 1.81%. The diff coverage is 34.77%.

:mega: This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##           master    #3906      +/-   ##
==========================================
- Coverage   72.93%   71.12%   -1.81%     
==========================================
  Files          83       20      -63     
  Lines        5368     3276    -2092     
==========================================
- Hits         3915     2330    -1585     
+ Misses       1453      946     -507     
Impacted Files Coverage Δ
frontend/src/js/controllers/authCtrl.js 53.91% <6.38%> (-12.95%) :arrow_down:
frontend/src/js/controllers/permissionCtrl.js 36.36% <22.22%> (-63.64%) :arrow_down:
frontend/src/js/controllers/challengeCtrl.js 62.79% <32.25%> (-10.91%) :arrow_down:
frontend/src/js/controllers/updateProfileCtrl.js 82.55% <44.44%> (-10.30%) :arrow_down:
frontend/src/js/controllers/profileCtrl.js 80.89% <45.45%> (-11.96%) :arrow_down:
...ntend/src/js/controllers/challengeHostTeamsCtrl.js 70.50% <66.66%> (-1.18%) :arrow_down:
frontend/src/js/controllers/teamsCtrl.js 71.17% <75.00%> (ø)
frontend/src/js/controllers/challengeListCtrl.js 95.74% <80.00%> (+1.06%) :arrow_up:
frontend/src/js/controllers/ChallengeInviteCtrl.js 100.00% <100.00%> (ø)
frontend/src/js/controllers/SubmissionFilesCtrl.js 95.45% <100.00%> (ø)
... and 5 more

... and 63 files with indirect coverage changes

Impacted Files Coverage Δ
frontend/src/js/controllers/authCtrl.js 53.91% <6.38%> (-12.95%) :arrow_down:
frontend/src/js/controllers/permissionCtrl.js 36.36% <22.22%> (-63.64%) :arrow_down:
frontend/src/js/controllers/challengeCtrl.js 62.79% <32.25%> (-10.91%) :arrow_down:
frontend/src/js/controllers/updateProfileCtrl.js 82.55% <44.44%> (-10.30%) :arrow_down:
frontend/src/js/controllers/profileCtrl.js 80.89% <45.45%> (-11.96%) :arrow_down:
...ntend/src/js/controllers/challengeHostTeamsCtrl.js 70.50% <66.66%> (-1.18%) :arrow_down:
frontend/src/js/controllers/teamsCtrl.js 71.17% <75.00%> (ø)
frontend/src/js/controllers/challengeListCtrl.js 95.74% <80.00%> (+1.06%) :arrow_up:
frontend/src/js/controllers/ChallengeInviteCtrl.js 100.00% <100.00%> (ø)
frontend/src/js/controllers/SubmissionFilesCtrl.js 95.45% <100.00%> (ø)
... and 5 more

... and 63 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 923fbf9...a0f23e0. Read the comment docs.

codecov-commenter avatar Mar 31 '23 10:03 codecov-commenter