Add condition to check if there are any Spotify tracks
I would like to only append some text which includes the list of Spotify tracks if there are actually any played during the activity. It would be nice to be able to have a condition for this.
I was quickly taking a look at the code and it seems like there might be a bug with the condition logic:
if (tracks.length > 0) {
if (op == RecipeOperator.Equal) {
valid = trackTitles.filter((t) => t == value).length > 0
} else if (op == RecipeOperator.Like) {
valid = trackTitles.filter((t) => t.includes(t)).length > 0
} else if (op == RecipeOperator.NotLike) {
valid = trackTitles.filter((t) => !t.includes(t)).length > 0
}
} else if (op == RecipeOperator.NotLike) {
valid = true
}
I would expect it to be t.includes(value) instead of t.includes(t).
I guess in the meantime because of this bug I can just use the includes with any value and it will always only be true when we have at least one track in the list.
You are right. I merged the PR and should be deployed on the weekend, thanks for spotting this.
Issue flagged as stale for being inactive for 28 days, please report status if this is still relevant.
Issue closed due to inactivity, feel free to update and re-open it if necessary.