You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2020/11/12 17:43:33 UTC

[GitHub] [incubator-pinot] zhangloo333 commented on a change in pull request #6260: [TE] frontend - harleyjj/alert-details - change alert charting logic …

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:
users@infra.apache.org



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