core icon indicating copy to clipboard operation
core copied to clipboard

Add condition to check if there are any Spotify tracks

Open PabiGamito opened this issue 1 year ago • 2 comments

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.

PabiGamito avatar Sep 11 '24 23:09 PabiGamito

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.

PabiGamito avatar Sep 11 '24 23:09 PabiGamito

You are right. I merged the PR and should be deployed on the weekend, thanks for spotting this.

igoramadas avatar Sep 12 '24 07:09 igoramadas

Issue flagged as stale for being inactive for 28 days, please report status if this is still relevant.

github-actions[bot] avatar Oct 10 '24 10:10 github-actions[bot]

Issue closed due to inactivity, feel free to update and re-open it if necessary.

github-actions[bot] avatar Oct 14 '24 10:10 github-actions[bot]