소스 검색

Fix bug in notes for geo scrobbles

Colin Powell 1 년 전
부모
커밋
635e8053cd
1개의 변경된 파일6개의 추가작업 그리고 5개의 파일을 삭제
  1. 6 5
      vrobbler/apps/scrobbles/scrobblers.py

+ 6 - 5
vrobbler/apps/scrobbles/scrobblers.py

@@ -268,10 +268,11 @@ def gpslogger_scrobble_location(
     scrobble = Scrobble.create_or_update(location, user_id, extra_data)
 
     provider = f"data source: {LOCATION_PROVIDERS[data_dict.get('prov')]}"
-    if scrobble.notes:
-        scrobble.notes = scrobble.notes + f"\n{provider}"
-    else:
-        scrobble.notes = provider
-    scrobble.save(update_fields=["notes"])
+    if scrobble: 
+        if scrobble.notes:
+            scrobble.notes = scrobble.notes + f"\n{provider}"
+        else:
+            scrobble.notes = provider
+        scrobble.save(update_fields=["notes"])
 
     return scrobble