|
@@ -183,16 +183,6 @@ func (e *Entry) EntryUpdateActiveHabit(pastureId int64) (err error) {
|
|
|
}
|
|
|
|
|
|
xToday.CurrMaxHabitId = currMaxHabit.Id
|
|
|
- defer func() {
|
|
|
- // 更新最后一次执行的id值
|
|
|
- if err == nil {
|
|
|
- e.DB.Model(new(model.NeckRingConfigure)).
|
|
|
- Where("name = ?", model.MaxHabit).
|
|
|
- Where("pasture_id = ?", pastureId).
|
|
|
- Update("value", currMaxHabit.Id)
|
|
|
- }
|
|
|
- }()
|
|
|
-
|
|
|
var processIds []int64
|
|
|
// 更新活动滤波
|
|
|
processIds, err = e.FirstFilterUpdate(pastureId, xToday)
|
|
@@ -212,6 +202,13 @@ func (e *Entry) EntryUpdateActiveHabit(pastureId int64) (err error) {
|
|
|
if err = e.SecondUpdateChangeFilter(pastureId, xToday); err != nil {
|
|
|
zaplog.Error("NeckRingCalculate", zap.Any("SecondUpdateChangeFilter", err), zap.Any("xToday", xToday))
|
|
|
}
|
|
|
+
|
|
|
+ if err = e.DB.Model(new(model.NeckRingConfigure)).
|
|
|
+ Where("name = ?", model.MaxHabit).
|
|
|
+ Where("pasture_id = ?", pastureId).
|
|
|
+ Update("value", processIds[len(processIds)-1]).Error; err != nil {
|
|
|
+ zaplog.Error("NeckRingCalculate", zap.Any("MaxHabit", err), zap.Any("xToday", xToday))
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 活动量校正系数和健康评分
|