[locations] Change name of model function
This commit is contained in:
@ -15,7 +15,7 @@ BNULL = {"blank": True, "null": True}
|
|||||||
User = get_user_model()
|
User = get_user_model()
|
||||||
|
|
||||||
GEOLOC_ACCURACY = int(getattr(settings, "GEOLOC_ACCURACY", 4))
|
GEOLOC_ACCURACY = int(getattr(settings, "GEOLOC_ACCURACY", 4))
|
||||||
GEOLOC_PROXIMITY = Decimal(getattr(settings, "GEOLOC_PROXIMITY", "0.00001"))
|
GEOLOC_PROXIMITY = Decimal(getattr(settings, "GEOLOC_PROXIMITY", "0.0001"))
|
||||||
|
|
||||||
|
|
||||||
class GeoLocation(ScrobblableMixin):
|
class GeoLocation(ScrobblableMixin):
|
||||||
@ -107,7 +107,7 @@ class GeoLocation(ScrobblableMixin):
|
|||||||
|
|
||||||
return has_moved
|
return has_moved
|
||||||
|
|
||||||
def named_in_proximity(self, named=True) -> models.QuerySet:
|
def in_proximity(self, named=True) -> models.QuerySet:
|
||||||
lat_min = Decimal(self.lat) - GEOLOC_PROXIMITY
|
lat_min = Decimal(self.lat) - GEOLOC_PROXIMITY
|
||||||
lat_max = Decimal(self.lat) + GEOLOC_PROXIMITY
|
lat_max = Decimal(self.lat) + GEOLOC_PROXIMITY
|
||||||
lon_min = Decimal(self.lon) - GEOLOC_PROXIMITY
|
lon_min = Decimal(self.lon) - GEOLOC_PROXIMITY
|
||||||
|
|||||||
@ -838,7 +838,7 @@ class Scrobble(TimeStampedModel):
|
|||||||
)
|
)
|
||||||
scrobble.stop(force_finish=True)
|
scrobble.stop(force_finish=True)
|
||||||
|
|
||||||
if existing_locations := location.named_in_proximity():
|
if existing_locations := location.in_proximity(named=True):
|
||||||
existing_location = existing_locations.first()
|
existing_location = existing_locations.first()
|
||||||
logger.info(
|
logger.info(
|
||||||
f"[scrobbling] moved to {location.id} but named location {existing_location.id} found, using it instead"
|
f"[scrobbling] moved to {location.id} but named location {existing_location.id} found, using it instead"
|
||||||
|
|||||||
Reference in New Issue
Block a user