Эх сурвалжийг харах

Merge branch 'feature/eta_2.3.8' into debug

hsun 2 долоо хоног өмнө
parent
commit
7aa36520dd

+ 9 - 0
services/ai_predict_model_index.go

@@ -7,6 +7,7 @@ import (
 	"eta/eta_api/services/data"
 	"eta/eta_api/utils"
 	"fmt"
+	"sort"
 	"time"
 )
 
@@ -207,6 +208,14 @@ func GetAiPredictChartDetailByData(indexItem *aiPredictModel.AiPredictModelIndex
 		}
 	}
 
+	// 图表数据这里均做一个升序排序
+	sort.Slice(actualData, func(i, j int) bool {
+		return actualData[i].DataTimestamp < actualData[j].DataTimestamp
+	})
+	sort.Slice(predictData, func(i, j int) bool {
+		return predictData[i].DataTimestamp < predictData[j].DataTimestamp
+	})
+
 	// 极值
 	actualMin, actualMax := utils.FindMinMax(actualValues)
 	predictMin, predictMax := utils.FindMinMax(predictValues)