ericaddison / APT_miniProject

0 stars 0 forks source link

GeoMap may be having trouble? #87

Open ericaddison opened 7 years ago

ericaddison commented 7 years ago

I deployed the new version and noticed that the GeoMap is not working... I tried backing up on my localhost dev server, and the last commit where I see a map showing up is d25b543961c5336abc4dac007d19bd2672490507... @psigourney do you know what the deal is here?

psigourney commented 7 years ago

I just did a git pull origin/master and the map is working locally. But it doesn't paint in the production version so it's likely an issue with the user data in prod vs. the local test data.

In web console, it looks like the values for lat and lng might not be populated:

GeoMap.html:
         {% for data in item_data %}
          (function(){
                var lat1 = {{ data.lat }};  << console shows no value here
                var lng1 = {{ data.lng }};  << console shows no value here
                var dateAdded = new Date('{{ data.date_added }}')
                var marker = new google.maps.Marker({position: {lat: lat1, lng: lng1}, map: map, dateAdded: dateAdded});

I was able to reproduce it locally.... add a new image to a stream, and for lat/lng, put a space in each.

In the production datastore, most of the images either have values or null, but one image looks like it just has "" for the values. Changing the getLatLng() model helper function to check for this.....

Currently:

   def getLatLng(self):
        if self.latitude is not None and self.longitude is not None:
            dict = {'lat':str(self.latitude), 'lng':str(self.longitude)}
            return dict
        else:
            return None

Changed:

    def getLatLng(self):
        if self.latitude is not None and self.longitude is not None and self.latitude.strip() != "" and self.longitude.strip() != "":
            dict = {'lat':str(self.latitude), 'lng':str(self.longitude)}
            return dict
        else:
            return None

Creating pull request now.