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

Commit 285db10

Browse files
committed
switched to lodash sort
1 parent 5e7ee90 commit 285db10

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

app/directives/challenge-user-place/challenge-user-place.directive.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,8 @@
4848
$scope.challenge.userDetails.submissions = $scope.challenge.userDetails.submissions.filter(function(submission) {
4949
return submission && submission.submissionImage;
5050
});
51-
$scope.challenge.userDetails.submissions.sort(function(left, right) {
52-
if (!left.placement && !right.placement) return 0;
53-
if (!right.placement) return -1;
54-
if (!left.placement) return 1;
55-
return left.placement - right.placement;
51+
$scope.challenge.userDetails.submissions = _.sortBy($scope.challenge.userDetails.submissions, function(submission) {
52+
return submission.placement;
5653
});
5754
}
5855
if (!$scope.challenge.isPrivate && $scope.challenge.userDetails && $scope.challenge.userDetails.submissions && $scope.challenge.userDetails.submissions.length > 0) {

0 commit comments

Comments
 (0)