<commit_before>var posts = ["s"];
var post_index = 0;
var post_count = 1;
var map;  // Google map object (global variable)

var lat;
var lng;

function left_card() {
  post_index = (post_index + post_count - 1) % post_count;
  retrieve_comments();
  retrieve_map();
}

function right_card() {
  post_index = (post_index + post_count + 1) % post_count;
  if(post_index == post_count - 3) {
    retrieve_posts();
  }
  retrieve_comments();
  retrieve_map();
}

function retrieve_map() {
  $.get("http://bounce9833.azurewebsites.net/api/post_bounces", {post_id: posts[post_index]._id}, function(bounces) {
    console.log(bounces);
    console.log(bounces[0]);
    console.log(bounces[0].loc);
    // Create a Google coordinate object for where to center the map
    var latlngCenter = new google.maps.LatLng( -123.1207, 49.2827 ); // Coordinates of Washington, DC (area centroid)
    
    // Map options for how to display the Google map
    var mapOptions = { zoom: 12, center: latlngCenter  };

    // Show the Google map in the div with the attribute id 'map-canvas'.
    map = new google.maps.Map(document.getElementById(posts[post_index]._id + 'right'), mapOptions);

    for(var i = 0; i < bounces.length; i++) {
      var latlng = {lat: bounces[i].loc[1], lng: bounces[i].loc[0]};
      var marker = new google.maps.Marker({
        position: latlng,
        map: map,
      });
    }
  });
}

function retrieve_comments() {
  $.get("http://bounce9833.azurewebsites.net/api/comment", {post_id: posts[post_index]._id}, function(comments) {
    var commentString = "";
    for (var i=0; i<comments.length; i++) {
      commentString += '<hr>' + comments[i].text + '<br>';
    }<commit_msg>attempt at fixing lat/lng issue<commit_after>var posts = ["s"];
var post_index = 0;
var post_count = 1;
var map;  // Google map object (global variable)

var lat;
var lng;

function left_card() {
  post_index = (post_index + post_count - 1) % post_count;
  retrieve_comments();
  retrieve_map();
}

function right_card() {
  post_index = (post_index + post_count + 1) % post_count;
  if(post_index == post_count - 3) {
    retrieve_posts();
  }
  retrieve_comments();
  retrieve_map();
}

function retrieve_map() {
  $.get("http://bounce9833.azurewebsites.net/api/post_bounces", {post_id: posts[post_index]._id}, function(bounces) {
    console.log(bounces);
    console.log(bounces[0]);
    console.log(bounces[0].loc);
    // Create a Google coordinate object for where to center the map
    var latlngCenter = new google.maps.LatLng({lng: -123.1207, lat: 49.2827 }); // Coordinates of Washington, DC (area centroid)
    
    // Map options for how to display the Google map
    var mapOptions = { zoom: 12, center: latlngCenter  };

    // Show the Google map in the div with the attribute id 'map-canvas'.
    map = new google.maps.Map(document.getElementById(posts[post_index]._id + 'right'), mapOptions);

    for(var i = 0; i < bounces.length; i++) {
      var latlng = {lat: bounces[i].loc[1], lng: bounces[i].loc[0]};
      var marker = new google.maps.Marker({
        position: latlng,
        map: map,
      });
    }
  });
}

function retrieve_comments() {
  $.get("http://bounce9833.azurewebsites.net/api/comment", {post_id: posts[post_index]._id}, function(comments) {
    var commentString = "";
    for (var i=0; i<comments.length; i++) {
      commentString += '<hr>' + comments[i].text + '<br>';
    }
{'fraction_non_alphanumeric': 0.15147963668326986, 'fraction_numerical': 0.019923820685613828, 'mean_word_length': 3.462745098039216, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 7, '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': '1006235', 'n_tokens_mistral': 1218, 'n_tokens_neox': 1161, 'n_words': 291}