DayMood replaces dominant mood #7
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What to build
DayMoodis the mean of everyMoodEntrymood on oneDate— the single mood value used wherever aDateneeds one, for analysis and calendar alike. ADatewith noMoodEntrys has noDayMood.This replaces
find_dominant_mood, which has a systematic bias: it picks the most frequent mood usingmax_by_key, andmax_by_keyreturns the last element when several are equally maximum. Because the counts array is indexed Awful through Rad, every tie resolves to the happier mood. A day with one Awful and one Rad currently reports Rad.Beyond the bias, frequency discards magnitude — four Meh and one Awful looks identical to five Meh — and correlation needs a continuous variable, not a five-level ordinal.
The calendar keeps showing a single mood per day by rounding the mean, so one rule serves both surfaces.
Acceptance criteria
DayMoodis computed as the mean of aDate's entry moodsfind_dominant_moodis gone, not merely fixedDayMoodby roundingDatewith no entries yields noDayMood, and the calendar renders that correctlyDaterule from #2, not the entry's raw offsetBlocked by