<commit_before>angular.module('dateworthy.idea', ['ngOpenFB', 'ngCordova'])

.controller('IdeaCtrl', function($location, $ionicHistory, $q, $ionicLoading, $scope, $stateParams, DateData, LikeADate) {

  
  $scope.initMap = function(latitude, longitude, name){
    console.log("Initiating Map...", latitude, longitude);
    var myLatlng = new google.maps.LatLng(latitude, longitude);
    var mapOptions = {
        center: myLatlng,
        zoom: 16,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map(document.getElementById("map"), mapOptions);
    navigator.geolocation.getCurrentPosition(function(pos) {
      map.setCenter(new google.maps.LatLng(latitude, longitude));
      var myLocation = new google.maps.Marker({
          position: new google.maps.LatLng(latitude, longitude),
          map: map,
          title: name
      });
    });
    $scope.map = map;
  };

  DateData.getDateIdeas(function(ideas) {
    $scope.ideas = ideas;
    console.log($scope.ideas);
    $scope.currentIdea = $stateParams.ideaId;
    $scope.imgWidth = window.innerWidth + 'px'; 
    console.log("innerwidth is", $scope.imgWidth);
    $scope.idea = $scope.ideas[$scope.currentIdea];
    setTimeout($scope.initMap($scope.idea.location.lat, $scope.idea.location.lng, $scope.idea.name), 500);
  });


  $scope.like = function() {
    console.log("What is this?");
    console.log($scope.ideas);
    $scope.ideas[currentIdea].liked = 1;
    $scope.ideas[currentIdea].disliked = 0;
    var tagnames = DateData.getTags();
    for (var prop in tagnames) {
      if(tagnames[prop] !== undefined){
        LikeADate.increaseTagWeight(tagnames[prop], function(results){console.log(results)});
      }
    };
  }

  $scope.dislike = function() {
    $scope.ideas[$scope.currentIdea].disliked = 1;
    $scope.ideas[$scope.currentIdea].liked = 0;  
    var tagnames = DateData.getTags();
    for (var prop in tagnames) {
      if(tagnames[prop] !== undefined){
        LikeADate.decreaseTagWeight(tagnames[prop], function(results){console.log(results)});
      }
    };
  };

  $scope.goBack = function() {
    $ionicHistory.goBack();
  };

  // MAPS INTEGRATION 
  

});

<commit_msg>(feat) Like/Dislike working for idea detail page<commit_after>angular.module('dateworthy.idea', ['ngOpenFB', 'ngCordova'])

.controller('IdeaCtrl', function($location, $ionicHistory, $q, $ionicLoading, $scope, $stateParams, DateData, LikeADate) {

  
  $scope.initMap = function(latitude, longitude, name){
    console.log("Initiating Map...", latitude, longitude);
    var myLatlng = new google.maps.LatLng(latitude, longitude);
    var mapOptions = {
        center: myLatlng,
        zoom: 16,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map(document.getElementById("map"), mapOptions);
    navigator.geolocation.getCurrentPosition(function(pos) {
      map.setCenter(new google.maps.LatLng(latitude, longitude));
      var myLocation = new google.maps.Marker({
          position: new google.maps.LatLng(latitude, longitude),
          map: map,
          title: name
      });
    });
    $scope.map = map;
  };

  DateData.getDateIdeas(function(ideas) {
    $scope.ideas = ideas;
    console.log($scope.ideas);
    $scope.currentIdea = $stateParams.ideaId;
    $scope.imgWidth = window.innerWidth + 'px'; 
    console.log("innerwidth is", $scope.imgWidth);
    $scope.idea = $scope.ideas[$scope.currentIdea];
    setTimeout($scope.initMap($scope.idea.location.lat, $scope.idea.location.lng, $scope.idea.name), 500);
  });


  $scope.like = function() {
    var currentIdea = $scope.currentIdea;
    $scope.ideas[currentIdea].liked = 1;
    $scope.ideas[currentIdea].disliked = 0;
    var tagnames = DateData.getTags();
    for (var prop in tagnames) {
      if(tagnames[prop] !== undefined){
        LikeADate.increaseTagWeight(tagnames[prop], function(results){console.log(results)});
      }
    };
    LikeADate.markLike($scope.ideas[currentIdea].dateIdeaID);
  }

  $scope.dislike = function() {
    var currentIdea = $scope.currentIdea;
    $scope.ideas[$scope.currentIdea].disliked = 1;
    $scope.ideas[$scope.currentIdea].liked = 0;  
    var tagnames = DateData.getTags();
    for (var prop in tagnames) {
      if(tagnames[prop] !== undefined){
        LikeADate.decreaseTagWeight(tagnames[prop], function(results){console.log(results)});
      }
    };
    LikeADate.markDislike($scope.ideas[currentIdea].dateIdeaID);
  };

  $scope.goBack = function() {
    $ionicHistory.goBack();
  };

  // MAPS INTEGRATION 
  

});


{'fraction_non_alphanumeric': 0.15461891242629394, 'fraction_numerical': 0.003930989298973575, 'mean_word_length': 3.4336882865440463, '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': '5200431', 'n_tokens_mistral': 1618, 'n_tokens_neox': 1526, 'n_words': 248}