1.1 --- a/src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt Mon Oct 30 10:06:22 2023 +0100 1.2 +++ b/src/main/kotlin/de/uapcore/lightpit/dao/PostgresDataAccessObject.kt Mon Oct 30 14:44:36 2023 +0100 1.3 @@ -557,7 +557,14 @@ 1.4 queryAll { it.extractIssue() } 1.5 } 1.6 1.7 - override fun listIssues(project: Project, includeDone: Boolean, version: Version?, component: Component?): List<Issue> = 1.8 + override fun listIssues( 1.9 + project: Project, 1.10 + includeDone: Boolean, 1.11 + specificVersion: Boolean, 1.12 + version: Version?, 1.13 + specificComponent: Boolean, 1.14 + component: Component? 1.15 + ): List<Issue> = 1.16 withStatement( 1.17 """$issueQuery where i.project = ? and 1.18 (? or phase < 2) and 1.19 @@ -565,21 +572,16 @@ 1.20 (not ? or component = ?) and (not ? or component is null) 1.21 """.trimIndent() 1.22 ) { 1.23 - fun <T : Entity> applyFilter(search: T?, fflag: Int, nflag: Int, idcol: Int) { 1.24 - if (search == null) { 1.25 - setBoolean(fflag, false) 1.26 - setBoolean(nflag, false) 1.27 - setInt(idcol, 0) 1.28 - } else { 1.29 - setBoolean(fflag, true) 1.30 - setBoolean(nflag, false) 1.31 - setInt(idcol, search.id) 1.32 - } 1.33 - } 1.34 setInt(1, project.id) 1.35 setBoolean(2, includeDone) 1.36 - applyFilter(version, 3, 5, 4) 1.37 - applyFilter(component, 6, 8, 7) 1.38 + 1.39 + setBoolean(3, specificVersion && version != null) 1.40 + setInt(4, version?.id ?: 0) 1.41 + setBoolean(5, specificVersion && version == null) 1.42 + 1.43 + setBoolean(6, specificComponent && component != null) 1.44 + setInt(7, component?.id ?: 0) 1.45 + setBoolean(8, specificComponent && component == null) 1.46 1.47 queryAll { it.extractIssue() } 1.48 }