Browse Source

crontab: neckRingMerge update

Yi 1 month ago
parent
commit
668fc095f8
2 changed files with 11 additions and 13 deletions
  1. 7 7
      model/neck_ring_original.go
  2. 4 6
      util/util_test.go

+ 7 - 7
model/neck_ring_original.go

@@ -126,13 +126,13 @@ func (n *NeckRingOriginalMerge) IsMageData(data *NeckRingOriginal, xframeId int3
 }
 }
 
 
 func (n *NeckRingOriginalMerge) SumAvg() {
 func (n *NeckRingOriginalMerge) SumAvg() {
-	n.Rumina = int32(float32(n.Rumina) / float32(n.RecordCount) * float32(n.RecordCount))
-	n.Inactive = int32(float32(n.Inactive) / float32(n.RecordCount) * float32(n.RecordCount))
-	n.Active = int32(float32(n.Active) / float32(n.RecordCount) * float32(n.RecordCount))
-	n.Intake = int32(float32(n.Intake) / float32(n.RecordCount) * float32(n.RecordCount))
-	n.Other = int32(float32(n.Other) / float32(n.RecordCount) * float32(n.RecordCount))
-	n.Gasp = int32(float32(n.Gasp) / float32(n.RecordCount) * float32(n.RecordCount))
-	n.High = int32(float32(n.High) / float32(n.RecordCount) * float32(n.RecordCount))
+	n.Rumina = int32(float32(n.Rumina) / float32(n.RecordCount) * DefaultRecordCount)
+	n.Inactive = int32(float32(n.Inactive) / float32(n.RecordCount) * DefaultRecordCount)
+	n.Active = int32(float32(n.Active) / float32(n.RecordCount) * DefaultRecordCount)
+	n.Intake = int32(float32(n.Intake) / float32(n.RecordCount) * DefaultRecordCount)
+	n.Other = int32(float32(n.Other) / float32(n.RecordCount) * DefaultRecordCount)
+	n.Gasp = int32(float32(n.Gasp) / float32(n.RecordCount) * DefaultRecordCount)
+	n.High = int32(float32(n.High) / float32(n.RecordCount) * DefaultRecordCount)
 	n.Voltage = int32(float32(n.Voltage) / float32(n.RecordCount))
 	n.Voltage = int32(float32(n.Voltage) / float32(n.RecordCount))
 }
 }
 
 

+ 4 - 6
util/util_test.go

@@ -557,10 +557,8 @@ func Test_demo(t *testing.T) {
 		fmt.Println("2")
 		fmt.Println("2")
 	}*/
 	}*/
 
 
-	nowTime := time.Now().Local()
-	currentMonth := nowTime.Format("2006-01")
-	startMonth := nowTime.AddDate(0, -5, 0).Format("2006-01")
-
-	monthRang, err := GetMonthsBetween(startMonth, currentMonth)
-	fmt.Println(monthRang, err)
+	realityDay, _ := TimeParseLocal("2006-01-02", "2025-07-10")
+	endDay, _ := TimeParseLocal("2006-01-02", "2025-07-05")
+	overdueDay := int32(DaysBetween(realityDay.Unix(), endDay.Unix()))
+	fmt.Println(overdueDay)
 }
 }