Ver Fonte

Fix bug in GeoLocation setting

Colin Powell há 1 ano atrás
pai
commit
a274796405
2 ficheiros alterados com 6 adições e 5 exclusões
  1. 2 2
      vrobbler/apps/locations/models.py
  2. 4 3
      vrobbler/apps/scrobbles/models.py

+ 2 - 2
vrobbler/apps/locations/models.py

@@ -13,7 +13,8 @@ logger = logging.getLogger(__name__)
 BNULL = {"blank": True, "null": True}
 User = get_user_model()
 
-ACCURACY = getattr(settings, "GEOLOC_ACCURACY", 3)
+GEOLOC_ACCURACY = getattr(settings, "GEOLOC_ACCURACY", 3)
+
 
 class GeoLocation(ScrobblableMixin):
     COMPLETION_PERCENT = getattr(settings, "LOCATION_COMPLETION_PERCENT", 100)
@@ -72,7 +73,6 @@ class GeoLocation(ScrobblableMixin):
         location = cls.objects.filter(
             lat=data_dict.get("lat"),
             lon=data_dict.get("lon"),
-            altitude=data_dict.get("altitude"),
         ).first()
 
         if not location:

+ 4 - 3
vrobbler/apps/scrobbles/models.py

@@ -692,7 +692,9 @@ class Scrobble(TimeStampedModel):
                     same_title = last_location.title == self.media_obj.title
 
                 logger.info(f"{self.timestamp}")
-                logger.info(f"Last lat: {last_location.lat}, last long {last_location.lon}, last title {last_location.title}")
+                logger.info(
+                    f"Last lat: {last_location.lat}, last long {last_location.lon}, last title {last_location.title}"
+                )
                 logger.info(
                     f"Our lat {self.media_obj.lat}, Our lon {self.media_obj.lon} or our title {self.media_obj.title}"
                 )
@@ -782,8 +784,7 @@ class Scrobble(TimeStampedModel):
                 logger.info(
                     "[scrobbling] scrobble for geo location with identical timestamp found"
                 )
-                # TODO Fix return type, can we ever return a Scrobble?
-                return
+                return dup
 
         scrobble = (
             cls.objects.filter(