Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix playing section titles bug #1289

Closed
wants to merge 1 commit into from
Closed

Fix playing section titles bug #1289

wants to merge 1 commit into from

Conversation

sewe2000
Copy link
Contributor

@sewe2000 sewe2000 commented Jun 7, 2022

Resolves #1168 at least in the discogs metadata provider.
I also created a test covering my changes.
I would be grateful if someone reviewed my code.

fetchMock.reset();
});

it('search for albums', async () => {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, this test won't do anything. You just set up a mock then run a loop on an empty array, which will not run any expects. The mock will not be consumed since there is nothing that could call it in this test.

if (track.sub_tracks) {
track.sub_tracks.forEach(subTrack => tracklist.push(this.discogsTrackToGeneric(subTrack, artist)));
track.sub_tracks.forEach(subTrack => {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't push in a for each loop, just use map, that's what it's for.

@@ -105,6 +114,11 @@ class DiscogsMetaProvider extends MetaProvider {
}

discogsTrackToGeneric(discogsTrack: DiscogsTrack, artist: string): Track {

if (discogsTrack.type_ !== 'track') {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just filter out non-tracks instead of filling the list with dummy entries and then filtering them out later.

@nukeop
Copy link
Owner

nukeop commented Jun 7, 2022

I left some comments, but ultimately I think this is not the way to go about it. We'll probably need to leave those entries, and just render them differently, since we don't want to leave them out altogether, we just need to stop adding them to the play queue. They need to still be visible in the album view, maybe rendered differently.

@nukeop nukeop added the needs changes The author needs to make changes to this pull request. label Jun 7, 2022
@sewe2000
Copy link
Contributor Author

Yeah, I'll try to fix this PR in some time.

@sewe2000
Copy link
Contributor Author

Unfortunately, I don't think I'm able to render those section titles differently, because I don't know React so much.

@nukeop nukeop closed this Jun 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs changes The author needs to make changes to this pull request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't attempt to play section titles
2 participants