소스 검색

cow: update weekly

Yi 1 주 전
부모
커밋
74f1d240d9
1개의 변경된 파일1개의 추가작업 그리고 2개의 파일을 삭제
  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).