fix: Add missing commas in function calls and improve code formatting
This commit is contained in:
@@ -272,9 +272,8 @@ class PlaylistService:
|
||||
# Ensure position doesn't create gaps - if position is too high, place at end
|
||||
current_sounds = await self.playlist_repo.get_playlist_sounds(playlist_id)
|
||||
max_position = len(current_sounds)
|
||||
if position > max_position:
|
||||
position = max_position
|
||||
|
||||
position = min(position, max_position)
|
||||
|
||||
await self.playlist_repo.add_sound_to_playlist(playlist_id, sound_id, position)
|
||||
logger.info(
|
||||
"Added sound %s to playlist %s for user %s at position %s",
|
||||
@@ -306,10 +305,10 @@ class PlaylistService:
|
||||
)
|
||||
|
||||
await self.playlist_repo.remove_sound_from_playlist(playlist_id, sound_id)
|
||||
|
||||
|
||||
# Reorder remaining sounds to eliminate gaps
|
||||
await self._reorder_playlist_positions(playlist_id)
|
||||
|
||||
|
||||
logger.info(
|
||||
"Removed sound %s from playlist %s for user %s and reordered positions",
|
||||
sound_id,
|
||||
@@ -326,7 +325,7 @@ class PlaylistService:
|
||||
sounds = await self.playlist_repo.get_playlist_sounds(playlist_id)
|
||||
if not sounds:
|
||||
return
|
||||
|
||||
|
||||
# Create sequential positions: 0, 1, 2, 3...
|
||||
sound_positions = [(sound.id, index) for index, sound in enumerate(sounds)]
|
||||
await self.playlist_repo.reorder_playlist_sounds(playlist_id, sound_positions)
|
||||
|
||||
Reference in New Issue
Block a user