Added condition to getTreeTagJoinClause for an INNER JOIN on trees and tree_tag when tagId is 0, so that trees can be filtered by all trees with a tag.
Please check if the PR fulfills these requirements
[x] The commit message follows our guidelines
Issue
What is the current behavior?
If the tagId is null getTreeTagJoinClause currently returns all trees that do not have a tree_tag record (SELECT ... from trees LEFT JOIN tree_tag ON trees.id=tree_tag.tree_id WHERE (tree_tag.tag_id ISNULL)), otherwise it returns a query for all trees with the tagId specified(SELECT ... from trees JOIN tree_tag ON trees.id=tree_tag.tree_id WHERE (tree_tag.tag_id=${tagId})).
What is the new behavior?
Added a condition so that if tagId is "0" (string), then it will return all trees that have a tree tag record (SELECT ... from trees INNER JOIN tree_tag ON trees.id=tree_tag.tree_id).
Breaking change
Does this PR introduce a breaking change?
No breaking changes.
Description
Added condition to getTreeTagJoinClause for an INNER JOIN on trees and tree_tag when tagId is 0, so that trees can be filtered by all trees with a tag.
Issue(s) addressed
What kind of change(s) does this PR introduce?
Please check if the PR fulfills these requirements
Issue
What is the current behavior? If the tagId is null getTreeTagJoinClause currently returns all trees that do not have a tree_tag record (
SELECT ... from trees LEFT JOIN tree_tag ON trees.id=tree_tag.tree_id WHERE (tree_tag.tag_id ISNULL)
), otherwise it returns a query for all trees with the tagId specified(SELECT ... from trees JOIN tree_tag ON trees.id=tree_tag.tree_id WHERE (tree_tag.tag_id=${tagId})
).What is the new behavior? Added a condition so that if tagId is "0" (string), then it will return all trees that have a tree tag record (
SELECT ... from trees INNER JOIN tree_tag ON trees.id=tree_tag.tree_id
).Breaking change
Does this PR introduce a breaking change? No breaking changes.
Other useful information