fixes issue query returning issues more than once

Sat, 23 Jan 2021 14:47:59 +0100

author
Mike Becker <universe@uap-core.de>
date
Sat, 23 Jan 2021 14:47:59 +0100
changeset 183
61669abf277f
parent 182
53f0e2685ad5
child 184
e8eecee6aadf

fixes issue query returning issues more than once

src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt file | annotate | diff | comparison | revisions
--- 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)
             """
         )
     }

mercurial