From d7ef1f67d8b3c20c2bbded87cd116e880ae028f5 Mon Sep 17 00:00:00 2001 From: rozetko Date: Fri, 8 Jun 2018 21:13:26 +0300 Subject: [PATCH] Fix issue with start_time > finish_time --- analytics/pattern_detection_model.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/analytics/pattern_detection_model.py b/analytics/pattern_detection_model.py index b2bfd6a..7680d20 100644 --- a/analytics/pattern_detection_model.py +++ b/analytics/pattern_detection_model.py @@ -89,8 +89,8 @@ class PatternDetectionModel: ts1 = int(time_value[0].timestamp() * 1000) ts2 = int(time_value[1].timestamp() * 1000) segments.append({ - 'start': ts1, - 'finish': ts2 + 'start': min(ts1, ts2), + 'finish': max(ts1, ts2) }) last_dataframe_time = dataframe.iloc[- 1]['timestamp']