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

Feature/sup 2120 fix #557

Merged
merged 3 commits into from
Nov 17, 2015
Merged
Changes from 2 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 @@ -44,10 +44,13 @@

function activate() {
$scope.numImages = 0;
if (!$scope.challenge.isPrivate && $scope.challenge.userDetails.submissions && $scope.challenge.userDetails.submissions.length > 0) {
$scope.numImages = $scope.challenge.userDetails.submissions.filter(function(submission) {
if ($scope.challenge.userDetails.submissions && $scope.challenge.userDetails.submissions.length > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Will $scope.challenge.userDetails always exist? Or do we need to check that that exists as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i'll add a check, thx

$scope.challenge.userDetails.submissions = $scope.challenge.userDetails.submissions.filter(function(submission) {
return submission && submission.submissionImage;
}).length;
});
}
if (!$scope.challenge.isPrivate && $scope.challenge.userDetails.submissions && $scope.challenge.userDetails.submissions.length > 0) {
$scope.numImages = $scope.challenge.userDetails.submissions.length;
$scope.selectedIndex = 0;
$scope.challenge.thumbnailId = $scope.challenge.userDetails.submissions[0].id;
$scope.imageURL = $scope.challenge.userDetails.submissions[0].submissionImage && $scope.challenge.userDetails.submissions[0].submissionImage.full;
Expand Down