From 0bbd488f0d507b3a551f0253db4f9b3261b246cc Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Mon, 12 Feb 2024 12:11:07 -0500 Subject: [PATCH] [scrobbling] Sometimes we wont have timestamps --- vrobbler/apps/scrobbles/models.py | 3 ++- vrobbler/apps/scrobbles/utils.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/vrobbler/apps/scrobbles/models.py b/vrobbler/apps/scrobbles/models.py index ef850f7..75d25e4 100644 --- a/vrobbler/apps/scrobbles/models.py +++ b/vrobbler/apps/scrobbles/models.py @@ -558,7 +558,8 @@ class Scrobble(TimeStampedModel): self.uuid = uuid4() # Microseconds mess up Django's filtering, and we don't need be that specific - self.timestamp = self.timestamp.replace(microsecond=0) + if self.timestamp: + self.timestamp = self.timestamp.replace(microsecond=0) self.media_type = self.MediaType(self.media_obj.__class__.__name__) return super(Scrobble, self).save(*args, **kwargs) diff --git a/vrobbler/apps/scrobbles/utils.py b/vrobbler/apps/scrobbles/utils.py index 8cd3d98..df4c6a3 100644 --- a/vrobbler/apps/scrobbles/utils.py +++ b/vrobbler/apps/scrobbles/utils.py @@ -92,9 +92,10 @@ def check_scrobble_for_finish( scrobble: "Scrobble", force_to_100=False, force_finish=False ) -> None: completion_percent = scrobble.media_obj.COMPLETION_PERCENT + if scrobble.media_type == "GeoLocation" and not force_finish: logger.info( - f"{scrobble.id} not complete, GeoLocs are completed when new one is created" + f"{scrobble.id} not complete, locations are ONLY completed when new one is created" ) return