zhangloo333 commented on a change in pull request #6260:
URL: https://github.com/apache/incubator-pinot/pull/6260#discussion_r522313251



##########
File path: 
thirdeye/thirdeye-frontend/app/pods/components/alert-details/component.js
##########
@@ -1032,25 +1032,22 @@ export default Component.extend({
     edgesLabel,
     color,
     useValue) {
-    // build set of anomalous values (newer of 2 sets of anomalies)
     if (!_.isEmpty(filteredAnomalies) && timeseries && 
!_.isEmpty(series.Current)) {
       const valuesCurrent = [];
+      // make sure anomalies ascend by startTime
+      filteredAnomalies.sort((a, b) => a.startTime - b.startTime);
+      let anomalyIndex = 0
+      let currentAnomaly = filteredAnomalies[anomalyIndex];
       // needed because anomalies with startTime before time window are 
possible
-      let currentAnomaly = filteredAnomalies.find(anomaly => {
-        return anomaly.startTime <= series.Current.timestamps[0];
-      });
-      let inAnomalyRange = currentAnomaly ? true : false;
+      let inAnomalyRange = currentAnomaly.startTime <= 
series.Current.timestamps[0];

Review comment:
       also, please make sure `series` has Current and timestamps properties.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to 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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to