Change index in playlist to start from 1

This commit is contained in:
Deluan 2020-05-26 13:50:15 -04:00
parent 3ca295c863
commit 201a22e613
2 changed files with 2 additions and 2 deletions

View file

@ -87,7 +87,7 @@ func Up20200516140647UpdatePlaylistTracks(tx *sql.Tx, id string, tracks string)
return err return err
} }
for i, trackId := range trackList { for i, trackId := range trackList {
_, err := stmt.Exec(id, trackId, i) _, err := stmt.Exec(id, trackId, i+1)
if err != nil { if err != nil {
log.Error("Error adding track to playlist", "playlistId", id, "trackId", trackId, err) log.Error("Error adding track to playlist", "playlistId", id, "trackId", trackId, err)
} }

View file

@ -112,7 +112,7 @@ func (r *playlistTrackRepository) Update(mediaFileIds []string) error {
} }
// Add new tracks, chunk by chunk // Add new tracks, chunk by chunk
pos := 0 pos := 1
for i := range chunks { for i := range chunks {
ins := Insert(r.tableName).Columns("playlist_id", "media_file_id", "id") ins := Insert(r.tableName).Columns("playlist_id", "media_file_id", "id")
for _, t := range chunks[i] { for _, t := range chunks[i] {