Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5e7ee90

Browse files
committedNov 18, 2015
Added sorting of submissions by placement
1 parent 1930618 commit 5e7ee90

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed
 

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@
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;
56+
});
5157
}
5258
if (!$scope.challenge.isPrivate && $scope.challenge.userDetails && $scope.challenge.userDetails.submissions && $scope.challenge.userDetails.submissions.length > 0) {
5359
$scope.numImages = $scope.challenge.userDetails.submissions.length;

0 commit comments

Comments
 (0)
This repository has been archived.