[tasks] A few little clean ups
This commit is contained in:
@ -1,11 +1,10 @@
|
||||
from dataclasses import dataclass
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
|
||||
from django.apps import apps
|
||||
from django.db import models
|
||||
from django.urls import reverse
|
||||
from scrobbles.dataclasses import BaseLogData, JSONDataclass
|
||||
from scrobbles.dataclasses import BaseLogData
|
||||
from scrobbles.mixins import LongPlayScrobblableMixin, ScrobblableConstants
|
||||
|
||||
BNULL = {"blank": True, "null": True}
|
||||
@ -33,6 +32,7 @@ class TaskLogData(BaseLogData):
|
||||
if isinstance(self.notes, list):
|
||||
note_block = "</br>".join(self.notes)
|
||||
|
||||
# DEPRECATED ... we don't store notes in dicts anymore
|
||||
if isinstance(self.notes, dict):
|
||||
for id, content in self.notes.items():
|
||||
note_block += content + "</br>"
|
||||
|
||||
@ -64,7 +64,7 @@ def convert_old_todoist_log_to_new(commit=False):
|
||||
print(f"Updating scrobble {scrobble.id}")
|
||||
if commit:
|
||||
scrobble.save(update_fields=["log"])
|
||||
print(f"Converted {scrobbles.count()} todoist tasks logs")
|
||||
print(f"Updated {scrobbles.count()} todoist tasks logs")
|
||||
|
||||
|
||||
def convert_notes_to_dict(commit=False):
|
||||
|
||||
Reference in New Issue
Block a user