Browse Source

crontab: cow health 牛只健康

Yi 1 month ago
parent
commit
efb6810608
1 changed files with 23 additions and 4 deletions
  1. 23 4
      module/crontab/health_warning.go

+ 23 - 4
module/crontab/health_warning.go

@@ -27,21 +27,40 @@ func (e *Entry) HealthWarning(pastureId int64, processIds []int64) {
 		lastScore         int32
 		healthWarningList []*model.NeckRingHealth
 	)
+
 	for _, habit := range newNeckActiveHabitList {
-		// 计算 sumChew 和 chew3dago
+		if habit.ChangeFilter <= -99 {
+			habit.ChangeFilter = 0
+		}
+
+		if habit.ChewFilter <= -99 {
+			habit.ChewFilter = 0
+		}
+
+		if habit.SumMinHigh <= -99 {
+			habit.SumMinHigh = 0
+		}
+
+		if habit.SumMaxHigh <= -99 {
+			habit.SumMaxHigh = 0
+		}
+
+		if habit.SumMinChew <= -99 {
+			habit.SumMinChew = 0
+		}
+
 		sumChew := habit.SumRumina + habit.SumIntake
 		chew3dago := habit.BeforeThreeSumRumina + habit.BeforeThreeSumIntake
-		// 判断是否满足 isWorse 条件
+
 		isWorse := 1
 		if habit.CowId == lastCowID && habit.HeatDate == lastHeatDate && habit.Score >= lastScore {
 			isWorse = 0
 		}
-		// 更新状态
+
 		lastCowID = habit.CowId
 		lastHeatDate = habit.HeatDate
 		lastScore = habit.Score
 
-		// 如果满足条件,添加到结果中
 		if isWorse == 1 {
 			newHealthWarning := model.NewNeckRingHealth(habit, sumChew, chew3dago)
 			if count := e.FindHealthWarning(pastureId, newHealthWarning); count <= 0 {