<commit_before>module.exports = function($scope, $stateParams, Submission, User, AppAuth){

    var challengeId = $stateParams.id;

    if (AppAuth.currentUser) {
      $scope.userPhotoUrl =
        AppAuth.currentUser.profiles[1].profile.photos[0].value;
    }


    Submission.find({ filter: {
      where: {challengeId: challengeId},
      include: ['votes', 'challenge']
    }}).$promise
      .then(function(submissions){
        console.log(submissions);
        $scope.challenge = submissions[0].challenge;
        $scope.submissions = submissions;
    });
};<commit_msg>#7 - Add ability to view number of votes for a submission<commit_after>module.exports = function($scope, $stateParams, Submission, User, AppAuth){

  var challengeId = $stateParams.id;

  AppAuth.ensureHasCurrentUser(function(user) {
    if (user && user.email && user.id) {
      $scope.currentUser =  user;
      if (user.profiles[1].profile.photos[0]) {
        $scope.userPhotoUrl =
          user.profiles[1].profile.photos[0].value;
      } else {
        $scope.userPhotoUrl = '';
      }
    } else {
      $scope.currentUser = {anonymous: true, id: null};
      $scope.hideVoting = true;
    }
  });

  Submission.find({ filter: {
    where: {challengeId: challengeId},
    include: ['votes', 'challenge']
  }}).$promise
    .then(function(submissions){
      //console.log(submissions);
      $scope.challenge = submissions[0].challenge;
      $scope.submissions = submissions;
  }, function(err){
    console.log(err);
  });
};
{'fraction_non_alphanumeric': 0.15237467018469658, 'fraction_numerical': 0.005936675461741424, 'mean_word_length': 3.0453333333333332, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4362251', 'n_tokens_mistral': 504, 'n_tokens_neox': 465, 'n_words': 85}