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