Closed hucario closed 3 years ago
realized a better way to fix it would be
if (rating && rating == song.songRating) {
return;
}
that way it only checks if it's already liked if it's liking the song. :ok_hand:
Unrelated but while I'm here:
The CSS ::before
property can be used instead of manually putting <span></span>
s everywhere for icons, so I may work on that soon
I've been noticing this issue for a while now. When the "dislike" button is pressed, the song is only skipped. The erroneous code: anesidora.js:247
Because JS likes being an "interesting" and "fun" language, unlike Python which is "uninteresting" and "reliable",
0
is evaluated asfalsy
in JS., while1
evaluates astruthy
. From the Pandora API doc:rating
isfalse
if disliking,true
if liking. so... if the song is already liked, it doesn't like it again (true
==1
(truthy)) but if you're trying to dislike it,false
==0 (unrated)
, returnsfalse
==1 (liked)
, continuesA workaround in the current version is just to like the song before disliking, although I don't know if that screws up the algorithm or something.
""improved"" code:
In JS,
===
checks type as well as value, while==
only checks value. ¯\_(ツ)_/¯ (seems like you're a python guy so I don't really expect for you to know that)It would also be good to move the check to after this block
in order to make sure that
rating
is a boolean.I'll open a PR for this Soon:tm: