Implementing confirm playlist array on confirm() button and server #27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Comments
So the problem with the previous implementation was that on a playlist selection, that playlist ID gets passed to the server to load the tracks, but it also populates the playlist_array (which we don't want, since the user hasn't pressed the confirm() button). The JS in playlist.ejs also successfully read the playlist_array from the server (ie. reads the length correctly, so it does go to /recommend).
What I'm trying to do
On the server, we now have a var 'playlist', which stores the selected playlist, and an array 'playlist_array', which stores the confirmed playlists. So the confirm() button should also send the playlist ID to the server to populate the 'playlist_array' via the POST '/confirmPlaylist' (in addition to adding all the tracks to Datastore). When I run this, I can see the tracks being added to Datastore in the confirm() function, but it doesn't seem to execute the POST (missing on both console + terminal).
The POST '/confirmPlaylist' starts on line 252 on
server.js
, and the confirm() button starts on like 213 onplaylist.ejs
.