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



##########
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:
       The picky requirement, I suggest using `isInAnomalyRang` for a boolean 
value. It's a clear variable name to express the variable type. it will enhance 
code readability.




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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to