<commit_before>angular.module('zeus.details', [])
  .controller('DetailsController', function($scope, Details, $routeParams) {
    $scope.data = {};
    $scope.reviews = {};
    $scope.users = {}
    $scope.hasReview = false;
    $scope.type = $routeParams.type;
    $scope.id = $routeParams.id;
    Details.getDetails($scope.type, $scope.id).then(function(data) {
      $scope.data = data;
      $scope.original_title = $scope.data.original_title;
      $scope.original_name = $scope.data.original_name;
      $scope.poster_path = $scope.data.poster_path;
      $scope.overview = $scope.data.overview;
      Details.getActors($scope.original_title).then(function(data) {
        $scope.actors = data.Actors.split(',');
        console.log($scope.original_title);
      });
    });
    var getReviews = function() {
      Details.getReviews($scope.type, $scope.id).then(function (reviews) {
        $scope.reviews = reviews.data.reviews;
        $scope.users = reviews.data.users;
        if ($scope.reviews.length > 0) {
          $scope.hasReview = true;
        }
        return reviews.data;
      });

    };
    getReviews();

    $scope.post = function() {
      var info = {
        title: $scope.reviewTitle,
        content: $scope.reviewBody,
        rating: $scope.reviewRating
      };
      Details.postReview($scope.type, $scope.id, info).then(function(review) {
        $scope.reviews.unshift(review.data.reviews);
        $scope.users[review.data.users.user_id] = review.data.users;
        $scope.hasReview = true;
        //Clear input fields
        $scope.reviewTitle = '';
        $scope.reviewBody = '';
        $scope.reviewRating = '';
      });
    };

    var today = new Date();
    var year = today.getFullYear().toString();
    var month = (today.getMonth() + 1).toString();
    var day = today.getDate().toString();
    $scope.fullDate = year + '-' + month + '-' + day;

    $scope.zip = '';

    $scope.getShowtimes = function() {
      Details.getShowtimes($scope.fullDate, $scope.zip).then(function(showtimes) {
        $scope.showtimes = showtimes;
        console.log(showtimes);
      });
      $scope.zip = '';
    };

    $scope.vote = function(review, vote){
      Details.upvote(review._id, vote)
    }
  });


<commit_msg>Upvote count is now updating in real time<commit_after>angular.module('zeus.details', [])
  .controller('DetailsController', function($scope, Details, $routeParams) {
    $scope.data = {};
    $scope.reviews = {};
    $scope.users = {}
    $scope.hasReview = false;
    $scope.type = $routeParams.type;
    $scope.id = $routeParams.id;
    Details.getDetails($scope.type, $scope.id).then(function(data) {
      $scope.data = data;
      $scope.original_title = $scope.data.original_title;
      $scope.original_name = $scope.data.original_name;
      $scope.poster_path = $scope.data.poster_path;
      $scope.overview = $scope.data.overview;
      Details.getActors($scope.original_title).then(function(data) {
        $scope.actors = data.Actors.split(',');
        console.log($scope.original_title);
      });
    });
    var getReviews = function() {
      Details.getReviews($scope.type, $scope.id).then(function (reviews) {
        $scope.reviews = reviews.data.reviews;
        $scope.users = reviews.data.users;
        if ($scope.reviews.length > 0) {
          $scope.hasReview = true;
        }
        return reviews.data;
      });

    };
    getReviews();

    $scope.post = function() {
      var info = {
        title: $scope.reviewTitle,
        content: $scope.reviewBody,
        rating: $scope.reviewRating
      };
      Details.postReview($scope.type, $scope.id, info).then(function(review) {
        $scope.reviews.unshift(review.data.reviews);
        $scope.users[review.data.users.user_id] = review.data.users;
        $scope.hasReview = true;
        //Clear input fields
        $scope.reviewTitle = '';
        $scope.reviewBody = '';
        $scope.reviewRating = '';
      });
    };

    var today = new Date();
    var year = today.getFullYear().toString();
    var month = (today.getMonth() + 1).toString();
    var day = today.getDate().toString();
    $scope.fullDate = year + '-' + month + '-' + day;

    $scope.zip = '';

    $scope.getShowtimes = function() {
      Details.getShowtimes($scope.fullDate, $scope.zip).then(function(showtimes) {
        $scope.showtimes = showtimes;
        console.log(showtimes);
      });
      $scope.zip = '';
    };

    $scope.vote = function(review, vote){
      Details.upvote(review._id, vote);
      review.voteCount+=vote;
    };
  });



{'fraction_non_alphanumeric': 0.16434176111595467, 'fraction_numerical': 0.0008718395815170009, 'mean_word_length': 2.540895061728395, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2986726', 'n_tokens_mistral': 1472, 'n_tokens_neox': 1440, 'n_words': 216}