Update algorithm and API documentation for smoking tracking app
- Enhanced the algorithm documentation to clarify the calculation of smoking intervals, including default values and edge cases. - Updated API documentation to reflect changes in response formats, including the addition of `exceeded_yesterday` and adjustments to time formatting to RFC3339. - Improved descriptions of user profile management and AI suggestions in the product documentation, ensuring consistency across all related files. - Removed outdated sequence diagram and UI documentation files to streamline project resources.
This commit is contained in:
@@ -123,6 +123,7 @@ type SmokeHomeSummary struct {
|
||||
TodayCount int
|
||||
ResistedCount int
|
||||
ReducedFromYesterday int
|
||||
ExceededYesterday bool
|
||||
}
|
||||
|
||||
// DashboardWeeklyStat 表示某一天的抽烟支数以及是否为今天。
|
||||
@@ -290,9 +291,7 @@ func (s *SmokeLogService) HomeSummary(ctx context.Context, uid int, asOf time.Ti
|
||||
}
|
||||
|
||||
reduced := int(yesterdayCount - todayCount)
|
||||
if reduced < 0 {
|
||||
reduced = 0
|
||||
}
|
||||
exceeded := reduced < 0
|
||||
|
||||
var lastSmokeAt *time.Time
|
||||
var last smokemodel.SmokeLog
|
||||
@@ -315,6 +314,7 @@ func (s *SmokeLogService) HomeSummary(ctx context.Context, uid int, asOf time.Ti
|
||||
TodayCount: int(todayCount),
|
||||
ResistedCount: int(resistedCount),
|
||||
ReducedFromYesterday: reduced,
|
||||
ExceededYesterday: exceeded,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user