Fix widget Mood type inference errors

- Use explicit Mood.missing and Mood.placeholder instead of shorthand
- Replace non-existent getAllData() with getData() using full date range

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Trey t
2025-12-09 23:09:12 -06:00
parent f2c510de50
commit 316513e516

View File

@@ -74,7 +74,7 @@ struct VoteWidgetProvider: TimelineProvider {
// Check if user has voted today
let todayEntry = PersistenceController.shared.getData(startDate: dayStart, endDate: dayEnd, includedDays: []).first
let hasVotedToday = todayEntry != nil && todayEntry?.mood != .missing && todayEntry?.mood != .placeholder
let hasVotedToday = todayEntry != nil && todayEntry?.mood != Mood.missing && todayEntry?.mood != Mood.placeholder
// Get today's mood if voted
let todaysMood: Mood? = hasVotedToday ? todayEntry?.mood : nil
@@ -82,8 +82,12 @@ struct VoteWidgetProvider: TimelineProvider {
// Get stats for display after voting
var stats: MoodStats? = nil
if hasVotedToday {
let allEntries = PersistenceController.shared.getAllData()
let validEntries = allEntries.filter { $0.mood != .missing && $0.mood != .placeholder }
let allEntries = PersistenceController.shared.getData(
startDate: Date(timeIntervalSince1970: 0),
endDate: Date(),
includedDays: []
)
let validEntries = allEntries.filter { $0.mood != Mood.missing && $0.mood != Mood.placeholder }
let totalCount = validEntries.count
if totalCount > 0 {