修复戒烟首页与统计中抽烟/忍住口径混淆
This commit is contained in:
@@ -163,7 +163,7 @@ func (s *SmokeLogService) List(ctx context.Context, uid int, req ListSmokeLogsRe
|
||||
case "smoke":
|
||||
tx = tx.Where("num > 0")
|
||||
case "resisted":
|
||||
tx = tx.Where("num = 0")
|
||||
tx = tx.Where("level = 0 AND num = 0")
|
||||
}
|
||||
|
||||
var total int64
|
||||
@@ -287,7 +287,7 @@ func (s *SmokeLogService) HomeSummary(ctx context.Context, uid int, asOf time.Ti
|
||||
if err := s.db.WithContext(ctx).
|
||||
Model(&smokemodel.SmokeLog{}).
|
||||
Where("uid = ? AND (deletetime IS NULL OR deletetime = 0)", uid).
|
||||
Where("num = 0 AND smoke_time = ?", todayKey).
|
||||
Where("level = 0 AND num = 0 AND smoke_time = ?", todayKey).
|
||||
Count(&resistedCount).Error; err != nil {
|
||||
return SmokeHomeSummary{}, fmt.Errorf("count resisted logs: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user