fixes issues that are assigned no version and no component are listed under all projects

Sat, 31 Oct 2020 09:50:15 +0100

author
Mike Becker <universe@uap-core.de>
date
Sat, 31 Oct 2020 09:50:15 +0100
changeset 154
3d10f2a390a1
parent 153
e914fbf4decc
child 155
3ace475224f7

fixes issues that are assigned no version and no component are listed under all projects

src/main/java/de/uapcore/lightpit/dao/postgres/PGIssueDao.java file | annotate | diff | comparison | revisions
--- a/src/main/java/de/uapcore/lightpit/dao/postgres/PGIssueDao.java	Sat Oct 31 09:27:36 2020 +0100
+++ b/src/main/java/de/uapcore/lightpit/dao/postgres/PGIssueDao.java	Sat Oct 31 09:50:15 2020 +0100
@@ -67,7 +67,8 @@
                         "select issueid, versionid from lpit_issue_resolved_version) "+
                         query +
                         "left join issue_version using (issueid) "+
-                        "where coalesce(versionid,-1) = ? and coalesce(component, -1) = coalesce(?, component, -1)"
+                        "where i.project = ? "+
+                        "and coalesce(versionid,-1) = ? and coalesce(component, -1) = coalesce(?, component, -1)"
         );
 
         find = connection.prepareStatement(query + "where issueid = ? ");
@@ -220,15 +221,17 @@
 
     @Override
     public List<Issue> list(Project project, Component component, Version version) throws SQLException {
-        listForVersion.setInt(1, Optional.ofNullable(version).map(Version::getId).orElse(-1));
-        listForVersion.setInt(2, Optional.ofNullable(component).map(Component::getId).orElse(-1));
+        listForVersion.setInt(1, project.getId());
+        listForVersion.setInt(2, Optional.ofNullable(version).map(Version::getId).orElse(-1));
+        listForVersion.setInt(3, Optional.ofNullable(component).map(Component::getId).orElse(-1));
         return executeQuery(listForVersion);
     }
 
     @Override
     public List<Issue> list(Project project, Version version) throws SQLException {
-        listForVersion.setInt(1, Optional.ofNullable(version).map(Version::getId).orElse(-1));
-        listForVersion.setNull(2, Types.INTEGER);
+        listForVersion.setInt(1, project.getId());
+        listForVersion.setInt(2, Optional.ofNullable(version).map(Version::getId).orElse(-1));
+        listForVersion.setNull(3, Types.INTEGER);
         return executeQuery(listForVersion);
     }
 

mercurial