Bedre sync
This commit is contained in:
@@ -53,6 +53,8 @@ class SongAltDanceData(BaseModel):
|
||||
|
||||
class PlaylistSongData(BaseModel):
|
||||
song_local_id: str
|
||||
song_title: str = ""
|
||||
song_artist: str = ""
|
||||
position: int
|
||||
status: str = "pending"
|
||||
is_workshop: bool = False
|
||||
@@ -182,7 +184,15 @@ def push(
|
||||
playlist_id_map[pl.local_id] = project.id
|
||||
|
||||
for ps in pl.songs:
|
||||
# Prøv først via song_id_map (lokal ID)
|
||||
song_id = song_id_map.get(ps.song_local_id)
|
||||
# Fallback: match på titel+artist
|
||||
if not song_id and ps.song_title:
|
||||
existing_song = db.query(Song).filter_by(
|
||||
title=ps.song_title, artist=ps.song_artist
|
||||
).first()
|
||||
if existing_song:
|
||||
song_id = existing_song.id
|
||||
if not song_id:
|
||||
continue
|
||||
proj_song = ProjectSong(
|
||||
|
||||
Reference in New Issue
Block a user