Browse Source

SONAR-16501 'projectCountBySCM' and 'projectCountByCI' count branches as projects

tags/9.6.0.59041
Duarte Meneses 2 years ago
parent
commit
b2d98671b6

+ 1
- 1
server/sonar-db-dao/src/main/resources/org/sonar/db/component/AnalysisPropertiesMapper.xml View File

@@ -39,7 +39,7 @@
inner join snapshots s on s.component_uuid = cp.uuid
inner join analysis_properties ap on ap.analysis_uuid = s.uuid
where
s.islast = ${_true} and ap.kee = #{analysisPropertyKey, jdbcType=VARCHAR}
cp.main_branch_project_uuid is null and s.islast = ${_true} and ap.kee = #{analysisPropertyKey, jdbcType=VARCHAR}
group by ap.text_value
</select>


+ 3
- 0
server/sonar-db-dao/src/test/java/org/sonar/db/component/AnalysisPropertiesDaoTest.java View File

@@ -184,7 +184,10 @@ public class AnalysisPropertiesDaoTest {
final int index = i;
ProjectDto project = dbTester.components().insertPrivateProjectDto();
dbTester.components().insertSnapshot(project, s -> s.setLast(true).setUuid("uuid" + index));
// branches shouldn't be taken into account
dbTester.components().insertProjectBranch(project);
}

underTest.insert(dbSession, new AnalysisPropertyDto().setKey(analysisPropertyKey).setValue("git").setAnalysisUuid("uuid0").setUuid("0"));
underTest.insert(dbSession, new AnalysisPropertyDto().setKey(analysisPropertyKey).setValue("svn").setAnalysisUuid("uuid1").setUuid("1"));
underTest.insert(dbSession, new AnalysisPropertyDto().setKey(analysisPropertyKey).setValue("undetected").setAnalysisUuid("uuid2").setUuid("2"));

Loading…
Cancel
Save