Skip to content

Commit 1dfc1b2

Browse files
authored
Merge pull request #61 from topcoder-platform/PLAT-2135
feat: manual reviewer payment amount
2 parents 045c81c + 8ecc480 commit 1dfc1b2

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

.circleci/config.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
version: 2
22
defaults: &defaults
33
docker:
4-
- image: circleci/python:2.7-stretch-browsers
4+
- image: cimg/python:3.11.0-browsers
55
install_dependency: &install_dependency
66
name: Installation of build and deployment dependencies.
77
command: |
8+
sudo apt update
89
sudo apt install jq
9-
sudo pip install awscli --upgrade
10-
sudo pip install docker-compose
10+
sudo apt install python3-pip
11+
sudo pip3 install awscli --upgrade
12+
sudo pip3 install docker-compose
1113
install_deploysuite: &install_deploysuite
1214
name: Installation of install_deploysuite.
1315
command: |
@@ -70,7 +72,7 @@ workflows:
7072
branches:
7173
only:
7274
- develop
73-
- feat/self-service-manual-payment
75+
- PLAT-2135
7476

7577
# Production builds are exectuted only on tagged commits to the
7678
# master branch.

src/services/ProcessorService.js

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,24 @@ function getReviewerPaymentData(v5Challenge) {
1919

2020
let reviewerPaymentAmount = null;
2121

22-
// Currently self service challenges & challenges with (metadata: { name: "reviewerPrize", value: "0" }) are considered as manual payments.
23-
// A manual payment is not overwritten with an automatically calculated value in OR
24-
if (v5Challenge.legacy != null && v5Challenge.legacy.selfService) {
25-
logger.info('Self service challenge. Treat as manual payment.')
26-
const reviewerPaymentAmounts = _.get(_.find(v5Challenge.prizeSets, prizeSet => prizeSet.type === config.REVIEWER_PAYMENT_TYPE), 'prizes', null)
27-
logger.info(`Reviewer payment amounts: ${JSON.stringify(reviewerPaymentAmounts)}`)
28-
reviewerPaymentAmount = reviewerPaymentAmounts != null && reviewerPaymentAmounts.length > 0 ? reviewerPaymentAmounts[0].value : null;
29-
}
30-
else {
22+
// if prizeSets[x].type == 'reviewer' then prizeSets[x].prizes[0].value is a "fixed" reviewer payment amount
23+
// this applies to Self Service & Topgear specific challenges
24+
// Note: for challenges that set a reviewer prize, but have multiple reviewers all reviewers will have the prize amount
25+
// and if this is not the desired behaviour, then we'll need to settle on a an interface to define which reviewer gets what amount
26+
// and it'll likely be through index (prizeSets[0] is 1st reviewer, prizeSets[1] is 2nd reviewer, etc.) since at this stage reviewer
27+
// information is not available
28+
const reviewerPaymentAmounts = _.get(_.find(v5Challenge.prizeSets, prizeSet => prizeSet.type === config.REVIEWER_PAYMENT_TYPE), 'prizes', null)
29+
logger.info(`${v5Challenge.id}: Reviewer payment amounts: ${JSON.stringify(reviewerPaymentAmounts)}`)
30+
reviewerPaymentAmount = reviewerPaymentAmounts != null && reviewerPaymentAmounts.length > 0 ? reviewerPaymentAmounts[0].value : null;
31+
32+
if (reviewerPaymentAmount == null) {
3133
// Since this is how Topgear currently stores the reviewer payment amount, we need to have this separate check
32-
// If Topgear ever changes the way it stores the reviewer payment amount, this check can be removed in favor of _.some(challenge.prizeSets.type == 'reviewer')
33-
// to make the amount extraction consistent
34+
// If Topgear ever changes the way it stores the reviewer payment amount, this check can be removed to make the amount extraction consistent
3435
reviewerPaymentAmount = _.get(_.find(metadata, m => m.name === 'reviewerPrize'), 'value', null)
35-
logger.info(`Reviewer payment amount (extracted from metadata): ${reviewerPaymentAmount}`)
36+
logger.info(`${v5Challenge.id}: Reviewer payment amount (extracted from metadata): ${reviewerPaymentAmount}`)
3637
}
3738

39+
3840
return {
3941
reviewerPaymentAmount,
4042
manual: reviewerPaymentAmount != null

0 commit comments

Comments
 (0)