aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sonar-db/src/main/resources/org/sonar/db/ce/CeActivityMapper.xml8
-rw-r--r--sonar-db/src/test/java/org/sonar/db/ce/CeActivityDaoTest.java4
2 files changed, 8 insertions, 4 deletions
diff --git a/sonar-db/src/main/resources/org/sonar/db/ce/CeActivityMapper.xml b/sonar-db/src/main/resources/org/sonar/db/ce/CeActivityMapper.xml
index 44502db6dfb..0b6090577a8 100644
--- a/sonar-db/src/main/resources/org/sonar/db/ce/CeActivityMapper.xml
+++ b/sonar-db/src/main/resources/org/sonar/db/ce/CeActivityMapper.xml
@@ -67,16 +67,16 @@
from ce_activity ca
<where>
<if test="query.onlyCurrents">
- ca.is_last=${_true}
+ and ca.is_last=${_true}
</if>
<if test="query.componentUuid != null">
- ca.component_uuid=#{query.componentUuid}
+ and ca.component_uuid=#{query.componentUuid}
</if>
<if test="query.status != null">
- ca.status=#{query.status}
+ and ca.status=#{query.status}
</if>
<if test="query.type != null">
- ca.task_type=#{query.type}
+ and ca.task_type=#{query.type}
</if>
</where>
</select>
diff --git a/sonar-db/src/test/java/org/sonar/db/ce/CeActivityDaoTest.java b/sonar-db/src/test/java/org/sonar/db/ce/CeActivityDaoTest.java
index 1323435fcdc..e9830ab9b9b 100644
--- a/sonar-db/src/test/java/org/sonar/db/ce/CeActivityDaoTest.java
+++ b/sonar-db/src/test/java/org/sonar/db/ce/CeActivityDaoTest.java
@@ -139,6 +139,10 @@ public class CeActivityDaoTest {
assertThat(underTest.countByQuery(db.getSession(), query)).isEqualTo(3);
query = new CeActivityQuery().setType("views");
assertThat(underTest.countByQuery(db.getSession(), query)).isEqualTo(1);
+
+ // select by multiple conditions
+ query = new CeActivityQuery().setType(REPORT).setOnlyCurrents(true).setComponentUuid("PROJECT_1");
+ assertThat(underTest.countByQuery(db.getSession(), query)).isEqualTo(1);
}
@Test