Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

SUP-2881, Show placements on challenge cards only for "Contest Submis… #620

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@
$scope.imageURL = $scope.challenge.userDetails.submissions[0].submissionImage && $scope.challenge.userDetails.submissions[0].submissionImage.full;
$scope.selectedImage = $scope.imageURL;

$scope.challenge.highestPlacement = _.max($scope.challenge.userDetails.submissions, 'placement').placement;
$scope.challenge.highestPlacement = _.min($scope.challenge.userDetails.submissions.filter(function(submission) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tladendo @parthshah @nlitwin Do you guys see use of _.min instead of _.max, inappropriate?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is placement ordered 1 highest, 2 second, i.e. the higher the number, the lower rank you are? If so, then _.min seems appropriate. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it should be like that. We already have that for other tracks, but somehow design subtrack is still using _.max.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am confused , shouldn't we be using _.min? 1 being the best placement / rank.
@vikasrohit can we merge this and have this qa'd once we have answered the above question?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we should and that is why I have changed it to _.min. However, I just want to make sure that I didn't miss anything which was trivial and I was not able to see that and further, why this is never caught when we are doing exactly opposite to what is required. :)

return submission.type === CONSTANTS.SUBMISSION_TYPE_CONTEST && submission.placement;
}), 'placement').placement;

if ($scope.challenge.highestPlacement == 1) {
$scope.challenge.wonFirst = true;
Expand Down
2 changes: 1 addition & 1 deletion app/services/challenge.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@
challenge.thumbnailId = challenge.userDetails.submissions[0].id;

challenge.highestPlacement = _.min(challenge.userDetails.submissions.filter(function(submission) {
return submission.placement;
return submission.type === CONSTANTS.SUBMISSION_TYPE_CONTEST && submission.placement;
}), 'placement').placement;

if (challenge.highestPlacement == 1) {
Expand Down
3 changes: 2 additions & 1 deletion app/topcoder.constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ angular.module("CONSTANTS", [])
"BUSY_PROGRESS_MESSAGE": "Processing..",
"REGISTRATION": "REGISTRATION",
"CODING": "CODING",
"REGISTERED": "REGISTERED"
"REGISTERED": "REGISTERED",
"SUBMISSION_TYPE_CONTEST": "Contest Submission"
})

;
2 changes: 1 addition & 1 deletion assets/css/directives/design-challenge-user-place.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ design-challenge-user-place {
.place {
&.completed, &.passed, &.didnt {
margin-bottom: -36px;
margin-top: 40px;
margin-top: 52px;
}
margin-bottom: 8px;
margin-top: 8px;
Expand Down
25 changes: 20 additions & 5 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ module.exports = function() {
CODING: 'CODING',

// users' status
REGISTERED: 'REGISTERED'
REGISTERED: 'REGISTERED',

// submission type
SUBMISSION_TYPE_CONTEST: 'Contest Submission'

}
},
Expand Down Expand Up @@ -88,7 +91,10 @@ module.exports = function() {
CODING: 'CODING',

// users' status
REGISTERED: 'REGISTERED'
REGISTERED: 'REGISTERED',

// submission type
SUBMISSION_TYPE_CONTEST: 'Contest Submission'

}
},
Expand Down Expand Up @@ -134,7 +140,10 @@ module.exports = function() {
CODING: 'CODING',

// users' status
REGISTERED: 'REGISTERED'
REGISTERED: 'REGISTERED',

// submission type
SUBMISSION_TYPE_CONTEST: 'Contest Submission'

}
},
Expand Down Expand Up @@ -180,7 +189,10 @@ module.exports = function() {
CODING: 'CODING',

// users' status
REGISTERED: 'REGISTERED'
REGISTERED: 'REGISTERED',

// submission type
SUBMISSION_TYPE_CONTEST: 'Contest Submission'

}
},
Expand Down Expand Up @@ -226,7 +238,10 @@ module.exports = function() {
CODING: 'CODING',

// users' status
REGISTERED: 'REGISTERED'
REGISTERED: 'REGISTERED',

// submission type
SUBMISSION_TYPE_CONTEST: 'Contest Submission'

}
}
Expand Down