<commit_before>var map;
var story_points_debug; 

 $(document).ready(function() {

  $.getJSON('/story_points_json', function(jd) {

    console.log(jd);

    story_points_json = jd;

    var story_points = JSON.parse( story_points_json );

    for (i = 0; i < story_points.length; i++) { 
      var x = story_points[i].fields.location_name;
      console.log(x);
    }

    story_points_debug = story_points;

  initialize_map(story_points);
  
  });

  //google.maps.event.addDomListener(window, 'load', initialize);

});

function initialize_map(story_points) {
  console.log("creating map");
  /*
  TODO:
    * Set the map to load centered at the latitude an longitude 
      of the first story point
    * Build a marker for each storypoint

  */
  
  var center_lat = parseFloat(story_points[0].fields.latitude);
  var center_lng = parseFloat(story_points[0].fields.longitude);
  var map = new google.maps.Map(document.getElementById("map"), {
      center: {lat: center_lat, lng: center_lng},
      zoom: 12
    });

}



      <commit_msg>Displaying the info from the database.<commit_after>var map;
var story_points_debug; 

 $(document).ready(function() {

  $.getJSON('/story_points_json', function(jd) {

    console.log(jd);

    story_points_json = jd;

    var story_points = JSON.parse( story_points_json );

    for (i = 0; i < story_points.length; i++) { 
      var x = story_points[i].fields.location_name;
      console.log(x);
    }

    story_points_debug = story_points;

  initialize_map(story_points);
  
  });

  //google.maps.event.addDomListener(window, 'load', initialize);

});

function initialize_map(story_points) {
  console.log("creating map");
  /*
  TODO:
    * Set the map to load centered at the latitude an longitude 
      of the first story point
    * Build a marker for each storypoint

  */
  
  var center_lat = parseFloat(story_points[0].fields.latitude);
  var center_lng = parseFloat(story_points[0].fields.longitude);
  var map = new google.maps.Map(document.getElementById("map"), {
      center: {lat: center_lat, lng: center_lng},
      zoom: 12
    });
  var infowindow = new google.maps.InfoWindow();

  for (i = 0; i < story_points.length; i++) { 
    var lat = parseFloat(story_points[i].fields.latitude);
    var lng = parseFloat(story_points[i].fields.longitude);
    var title = story_points[i].fields.title;
    var loc_name = story_points[i].fields.location_name;
    var text = story_points[i].fields.text;

    var contentString = '<div id="content">'+
      '<div id="siteNotice">'+
      '</div>'+
      '<h1 id="firstHeading" class="firstHeading">' + loc_name + '</h1>'+
      '<h2 id="secondHeading" class="secondHeading">' + title + '</h2>'+
      '<div id="bodyContent">'+
      '<p>' + text + '</p>'+
      '</div>'+
      '</div>';

    var marker = new google.maps.Marker({
      position: {lat: lat, lng: lng},
      map: map,
      animation: google.maps.Animation.DROP,
      contentString: contentString
    });

    google.maps.event.addListener(marker, 'click', function() { 
        infowindow.setContent(this.contentString);
        infowindow.open(map,this);
    });
  };

}



      
{'fraction_non_alphanumeric': 0.1443461781427669, 'fraction_numerical': 0.004737839545167404, 'mean_word_length': 3.2170439414114513, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 15, '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': '2935075', 'n_tokens_mistral': 1076, 'n_tokens_neox': 1035, 'n_words': 222}