[ 
https://issues.apache.org/jira/browse/IGNITE-9849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16670809#comment-16670809
 ] 

ASF GitHub Bot commented on IGNITE-9849:
----------------------------------------

dspavlov commented on a change in pull request #57: IGNITE-9849 Refactor Master 
trends
URL: https://github.com/apache/ignite-teamcity-bot/pull/57#discussion_r229880064
 
 

 ##########
 File path: 
ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/web/model/current/BuildStatisticsSummary.java
 ##########
 @@ -91,122 +96,122 @@ public BuildStatisticsSummary(Integer buildId){
     }
 
     /** Initialize build statistics. */
-    public void initialize(@Nonnull final ITeamcity teamcity) {
-        Build build = teamcity.getBuild(buildId);
+    public void initialize(@Nonnull final IStringCompactor compactor, @Nonnull 
final ITeamcityIgnited ignitedTeamcity) {
+        if (strIds.isEmpty()) {
+            strIds.put(STATUS_SUCCESS, compactor.getStringId(STATUS_SUCCESS));
+            strIds.put(TC_EXIT_CODE, compactor.getStringId(TC_EXIT_CODE));
+            strIds.put(TC_OOME, compactor.getStringId(TC_OOME));
+            strIds.put(TC_JVM_CRASH, compactor.getStringId(TC_JVM_CRASH));
+            strIds.put(TC_EXECUTION_TIMEOUT, 
compactor.getStringId(TC_EXECUTION_TIMEOUT));
+        }
+
+        FatBuildCompacted build = ignitedTeamcity.getFatBuild(buildId);
 
         isFakeStub = build.isFakeStub();
 
         if (isFakeStub)
             return;
 
         DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy'T'HH:mm:ss");
-        dateFormat.format(build.getFinishDate());
+
         startDate = dateFormat.format(build.getStartDate());
 
-        testOccurrences = build.testOccurrences;
+        int[] arr = new int[4];
 
-        duration = (build.getFinishDate().getTime() - 
build.getStartDate().getTime()) / 1000;
+        build.getAllTests().forEach(t -> {
+                if (t.getIgnoredFlag())
+                    arr[0]++;
+                else if (t.getMutedFlag())
+                    arr[1]++;
+                else if (t.status() != strIds.get(STATUS_SUCCESS))
+                    arr[2]++;
 
-        List<BuildRef> snapshotDependencies = 
getSnapshotDependencies(teamcity, build);
+            arr[3]++;
+        });
 
-        List<BuildRef> snapshotDependenciesWithProblems = 
getBuildsWithProblems(snapshotDependencies);
+        testOccurrences.ignored = arr[0];
+        testOccurrences.muted = arr[1];
+        testOccurrences.failed = arr[2];
+        testOccurrences.count = arr[3];
+        testOccurrences.passed = testOccurrences.count - 
testOccurrences.failed - testOccurrences.ignored -
+        testOccurrences.muted;
 
-        problemOccurrenceList = getProblems(teamcity, 
snapshotDependenciesWithProblems);
+        duration = (build.getFinishDate().getTime() - 
build.getStartDate().getTime()) / 1000;
 
-        totalProblems = getRes();
-    }
+        List<FatBuildCompacted> snapshotDependencies = 
getSnapshotDependencies(ignitedTeamcity, buildId);
 
-    private long getExecutionTimeoutCount(String buildTypeId) {
-        return 
getProblemsStream(buildTypeId).filter(ProblemOccurrence::isExecutionTimeout).count();
-    }
+        List<FatBuildCompacted> snapshotDependenciesWithProblems = 
getBuildsWithProblems(snapshotDependencies);
 
-    private long getJvmCrashProblemCount(String buildTypeId) {
-        return 
getProblemsStream(buildTypeId).filter(ProblemOccurrence::isJvmCrash).count();
-    }
+        problemOccurrenceList = getProblems(snapshotDependenciesWithProblems);
 
-    private long getExitCodeProblemsCount(String buildTypeId) {
-        return 
getProblemsStream(buildTypeId).filter(ProblemOccurrence::isExitCode).count();
+        totalProblems = getBuildTypeProblemsCount();
     }
 
-    private long getOomeProblemCount(String buildTypeId) {
-        return 
getProblemsStream(buildTypeId).filter(ProblemOccurrence::isOome).count();
+    /**
+     * @param problemName Problem name.
+     */
+    private long getProblemsCount(String problemName) {
+        if (problemOccurrenceList == null)
+            return 0;
+
+        return problemOccurrenceList.stream()
+            .filter(Objects::nonNull)
+            .filter(p -> p.type() == strIds.get(problemName)).count();
     }
 
     /**
      * Problems for all snapshot-dependencies.
      *
-     * @param teamcity Teamcity.
+     * @param builds Builds.
      */
-    private List<ProblemOccurrence> getProblems(@Nonnull final ITeamcity 
teamcity, List<BuildRef> builds){
-        List<ProblemOccurrence> problemOccurrences = new ArrayList<>();
+    private List<ProblemCompacted> getProblems(List<FatBuildCompacted> builds){
+        List<ProblemCompacted> problemOccurrences = new ArrayList<>();
 
-        for (BuildRef buildRef : builds)
-            problemOccurrences.addAll(teamcity
-                .getProblems(buildRef)
-                .getProblemsNonNull());
+        for (FatBuildCompacted build : builds)
+            problemOccurrences.addAll(
+                build.problems()
+            );
 
         return problemOccurrences;
     }
 
     /**
      * Snapshot-dependencies for build.
      *
-     * @param teamcity Teamcity.
-     * @param buildRef Build reference.
+     * @param ignitedTeamcity ignitedTeamcity.
+     * @param buildId Build Id.
      */
-    private List<BuildRef> getSnapshotDependencies(@Nonnull final ITeamcity 
teamcity, BuildRef buildRef){
-        FullQueryParams key = new FullQueryParams();
+    private List<FatBuildCompacted> getSnapshotDependencies(@Nonnull final 
ITeamcityIgnited ignitedTeamcity, Integer buildId){
+        List<FatBuildCompacted> snapshotDependencies = new ArrayList<>();
+        FatBuildCompacted build = ignitedTeamcity.getFatBuild(buildId);
 
-        key.setServerId(teamcity.serverId());
-        key.setBuildId(buildRef.getId());
+        if (build.isComposite()){
 
 Review comment:
   not only composite build can have a dependency. E.g. each build with test 
depends on the build with compilation

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Remove invalid builds from the selection
> ----------------------------------------
>
>                 Key: IGNITE-9849
>                 URL: https://issues.apache.org/jira/browse/IGNITE-9849
>             Project: Ignite
>          Issue Type: Sub-task
>            Reporter: Nikolai Kulagin
>            Assignee: Nikolai Kulagin
>            Priority: Minor
>
> In selection sometimes there are builds with abnormal values. For example, 
> the average number of failed tests is 25. But in the build [1953935] there 
> are 2939 failed tests. This is an anomalous value. Need to add the ability to 
> remove it from the selection. Build [1953935] - not valid.
> In total, 
> 1. While clicking on a point on the chart, show a button that allows marking 
> a build invalid and excludes it from further selections.
> 2. Reduce the number of erroneous exceptions. Compare the value with the 
> average, if the difference is small - ask for confirmation of the operation.
> 3. Add the ability to return an excluded build to the selection.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to