# HG changeset patch # User Mike Becker # Date 1611409679 -3600 # Node ID 61669abf277f8f8710e5f81ec5b6fdb6082c70f0 # Parent 53f0e2685ad56e659212d809b40d27f3ad620cd7 fixes issue query returning issues more than once diff -r 53f0e2685ad5 -r 61669abf277f src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt --- a/src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt Wed Jan 06 16:41:09 2021 +0100 +++ b/src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt Sat Jan 23 14:47:59 2021 +0100 @@ -547,11 +547,16 @@ with issue_version as ( select issueid, versionid from lpit_issue_affected_version union select issueid, versionid from lpit_issue_resolved_version - ) ${issueQuery} left join issue_version using (issueid) - where - (not ? or projectid = ?) and - (not ? or versionid = ?) and (not ? or versionid is null) and - (not ? or component = ?) and (not ? or component is null) + ), + filteterd_issues as ( + select distinct issueid from lpit_issue + left join issue_version using (issueid) + where + (not ? or project = ?) and + (not ? or versionid = ?) and (not ? or versionid is null) and + (not ? or component = ?) and (not ? or component is null) + ) + ${issueQuery} join filteterd_issues using (issueid) """ ) }