Przeglądaj źródła

Merge branch '11.6' into debug

Roc 2 lat temu
rodzic
commit
9d494adbe4
1 zmienionych plików z 4 dodań i 3 usunięć
  1. 4 3
      models/predict_edb_info_rule.go

+ 4 - 3
models/predict_edb_info_rule.go

@@ -663,9 +663,10 @@ func GetChartPredictEdbInfoDataListByRuleFinalValueHc(edbInfoId int, finalValue
 	}
 
 	var hcValue float64
-	finalValueDeciamal := decimal.NewFromFloat(finalValue)
-	dayDecimal := decimal.NewFromInt(int64(lenDay))
-	hcValue, _ = finalValueDeciamal.Div(dayDecimal).Float64()
+	lastValueDeciamal := decimal.NewFromFloat(allDataList[index-1].Value)            // 实际数据的最后一个值
+	finalValueDeciamal := decimal.NewFromFloat(finalValue)                           // 给定的终止数据
+	dayDecimal := decimal.NewFromInt(int64(lenDay))                                  // 需要作为分母的期数
+	hcValue, _ = finalValueDeciamal.Sub(lastValueDeciamal).Div(dayDecimal).Float64() // 计算出来的环差值
 
 	//获取后面的预测数据
 	predictEdbInfoData = make([]*EdbInfoSearchData, 0)