diff --git a/vrobbler/apps/locations/models.py b/vrobbler/apps/locations/models.py index 83248f1..b25db98 100644 --- a/vrobbler/apps/locations/models.py +++ b/vrobbler/apps/locations/models.py @@ -55,17 +55,9 @@ class GeoLocation(ScrobblableMixin): logger.error("No lat or lon keys in data dict") return - lat_int, lat_places = data_dict.get("lat", "").split(".") - lon_int, lon_places = data_dict.get("lon", "").split(".") - alt_int, alt_places = data_dict.get("alt", "").split(".") - - truncated_lat = lat_places[0:5] - truncated_lon = lon_places[0:5] - truncated_alt = alt_places[0:3] - - data_dict["lat"] = float(".".join([lat_int, truncated_lat])) - data_dict["lon"] = float(".".join([lon_int, truncated_lon])) - data_dict["altitude"] = float(".".join([alt_int, truncated_alt])) + data_dict["lat"] = float(data_dict.get("lat", "")) + data_dict["lon"] = float(data_dict.get("lon", "")) + data_dict["altitude"] = float(data_dict.get("alt", "")) location = cls.objects.filter( lat=data_dict.get("lat"), diff --git a/vrobbler/apps/locations/views.py b/vrobbler/apps/locations/views.py index 772bdc6..0f3de25 100644 --- a/vrobbler/apps/locations/views.py +++ b/vrobbler/apps/locations/views.py @@ -6,7 +6,7 @@ from scrobbles.stats import get_scrobble_count_qs class GeoLocationListView(generic.ListView): model = GeoLocation - paginate_by = 200 + paginate_by = 75 def get_queryset(self): return super().get_queryset().order_by("-created") diff --git a/vrobbler/apps/scrobbles/models.py b/vrobbler/apps/scrobbles/models.py index b50b80f..3a5f827 100644 --- a/vrobbler/apps/scrobbles/models.py +++ b/vrobbler/apps/scrobbles/models.py @@ -630,8 +630,14 @@ class Scrobble(TimeStampedModel): if self.media_obj.__class__.__name__ in ["GeoLocation"]: logger.info(f"Calculate proximity to last scrobble") if self.previous: - same_lat = self.previous.media_obj.lat == self.media_obj.lat - same_lon = self.previous.media_obj.lon == self.media_obj.lon + same_lat = ( + self.previous.media_obj.truncated_lat + == self.media_obj.truncated_lat + ) + same_lon = ( + self.previous.media_obj.truncated_lon + == self.media_obj.truncated_lon + ) if same_lat and same_lon: # We have moved logger.info("Yes - We're in the same place!") updatable = True