1.1.0: Smarter autocomplete + Statistics view
- AutocompleteEngine: MRV heuristic picks the most-constrained slot first at each step; historical scoring deprioritises dishes used in recent weeks (decay: 0.20 last week → 0.90 four+ weeks ago) - HomeViewModel: passes last 4 weeks as recentPlans to autocomplete - StatsView (Premium): streak, weeks planned, completion rate, top 8 dishes with bar charts, top 6 tags with colour bars — 6 languages - StoreManager: update product ID to approved bundle-ID convention - Version bump to 1.1.3 / build 48 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -113,16 +113,22 @@ final class HomeViewModel: ObservableObject {
|
||||
HapticManager.shared.notification(type: .warning)
|
||||
}
|
||||
|
||||
func autoComplete(plan: WeekPlan, dishes: [Dish], tags: [Tag], settings: AppSettings) {
|
||||
func autoComplete(plan: WeekPlan, dishes: [Dish], tags: [Tag], settings: AppSettings, allPlans: [WeekPlan] = []) {
|
||||
captureUndoSnapshot(plan: plan)
|
||||
isAutoCompleting = true
|
||||
|
||||
let recentPlans = allPlans
|
||||
.filter { $0.weekStartDate < plan.weekStartDate }
|
||||
.sorted { $0.weekStartDate > $1.weekStartDate }
|
||||
.prefix(4)
|
||||
|
||||
let emptySlots = plan.slots.filter { $0.dishId == nil && !$0.isEatingOut }
|
||||
let result = AutocompleteEngine.autocomplete(
|
||||
emptySlots: emptySlots,
|
||||
currentPlan: plan,
|
||||
allDishes: dishes,
|
||||
allTags: tags
|
||||
allTags: tags,
|
||||
recentPlans: Array(recentPlans)
|
||||
)
|
||||
|
||||
plan.updatedAt = Date()
|
||||
|
||||
Reference in New Issue
Block a user