Browse Source

cow: update weekly

Yi 1 week ago
parent
commit
74f1d240d9
1 changed files with 1 additions and 2 deletions
  1. 1 2
      module/crontab/cow_cron.go

+ 1 - 2
module/crontab/cow_cron.go

@@ -468,9 +468,8 @@ func (e *Entry) UpdateCowWeeklyHigh(cow *model.Cow) int32 {
 	weeklyActiveModelList := make([]*model.WeeklyActiveModel, 0)
 	startTime := time.Now().AddDate(0, 0, -8).Format(model.LayoutDate2)
 	endTime := time.Now().AddDate(0, 0, -2).Format(model.LayoutDate2)
-	selectStr := fmt.Sprintf(`IF(ROUND(AVG( h.high))>%d, ROUND(AVG( h.high)), %d) AS high`, minWeeklyActive.Value, minWeeklyActive.Value)
+	selectStr := fmt.Sprintf(`cow_id,heat_date,count(1) AS nb,IF(ROUND(AVG(high))>%d, ROUND(AVG(high)), %d) AS high`, minWeeklyActive.Value, minWeeklyActive.Value)
 	if err = e.DB.Model(new(model.NeckActiveHabit)).
-		Select("cow_id,heat_date,count(1) AS nb").
 		Select(selectStr).
 		Where("cow_id = ?", cow.Id).
 		Where("heat_date BETWEEN ? AND ?", startTime, endTime).