[GitHub] dspavlov commented on a change in pull request #57: IGNITE-9849 Refactor Master trends

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[GitHub] dspavlov commented on a change in pull request #57: IGNITE-9849 Refactor Master trends

GitBox
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_r229878447
 
 

 ##########
 File path: ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/teamcity/ignited/TeamcityIgnitedImpl.java
 ##########
 @@ -116,6 +119,142 @@ private String taskName(String taskName) {
         return conn.host();
     }
 
+    /** {@inheritDoc} */
+    public List<BuildRefCompacted> getFinishedBuildsCompacted(
+        @Nullable String buildTypeId,
+        @Nullable String branchName,
+        @Nullable Date sinceDate,
+        @Nullable Date untilDate) {
+        int unknownStatus = compactor.getStringId(STATUS_UNKNOWN);
+
+        List<BuildRefCompacted> buildRefs = getBuildHistoryCompacted(buildTypeId, branchName)
+            .stream().filter(b -> b.status() != unknownStatus).collect(Collectors.toList());
+
+        int idSince = 0;
+        int idUntil = buildRefs.size() - 1;
+
+        if (sinceDate != null) {
+            idSince = binarySearchDate(buildRefs, 0, buildRefs.size(), sinceDate, true);
+            idSince = idSince == -2 ? 0 : idSince;
 
 Review comment:
   To avoid magic numbers like -1, -2, -3 I can suggest introducing a constants

----------------------------------------------------------------
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:
[hidden email]


With regards,
Apache Git Services