Release Memby 0.2.64

This commit is contained in:
ponzischeme89
2026-08-14 13:32:14 +12:00
parent ad0c74f880
commit 05d95f51cd
33 changed files with 1142 additions and 112 deletions
+18 -4
View File
@@ -678,10 +678,11 @@ func (s *Server) heroRow(
s.loggerFor(ctx).Warn("hero policy unavailable", "error", err)
policy = store.HeroPolicy{}
}
pinned := s.pinnedHeroCandidates(ctx, policy.PinnedItemIDs)
placementPolicy := policy.Placement(store.HeroPlacementHome)
pinned := s.pinnedHeroCandidates(ctx, placementPolicy.PinnedItemIDs)
// Manual pins always lead. Schedules resolve on the gateway (never on a television),
// then the existing automatic/release-aware selection fills any remaining places.
scheduledIDs := activeHeroScheduleIDs(policy.Schedules, userID, now, location)
scheduledIDs := activeHeroScheduleIDs(policy.Schedules, store.HeroPlacementHome, userID, now, location)
scheduled := s.pinnedHeroCandidates(ctx, scheduledIDs)
// Rank a pool, then draw the row out of it. Ranking straight to the row's length is
// what made the hero the same four cards for a week — see rotateHeroCandidates.
@@ -700,7 +701,7 @@ func (s *Server) heroRow(
items = append(items, injectHeroFields(
candidate.Item,
heroLabel(candidate, now),
heroReasonForPosition(candidate, index, policy.PrimeSubtitle, now, location),
heroReasonForPosition(candidate, index, placementPolicy.PrimeSubtitle, now, location),
))
}
return &recommend.Row{
@@ -750,7 +751,7 @@ func mergePinnedHeroCandidates(
return out
}
func activeHeroScheduleIDs(schedules []store.HeroSchedule, userID string, now time.Time, location *time.Location) []string {
func activeHeroScheduleIDs(schedules []store.HeroSchedule, placement, userID string, now time.Time, location *time.Location) []string {
type active struct {
id string
priority int
@@ -761,6 +762,19 @@ func activeHeroScheduleIDs(schedules []store.HeroSchedule, userID string, now ti
if !schedule.Enabled || (schedule.UserID != "" && schedule.UserID != userID) || now.Before(schedule.StartAt) || !now.Before(schedule.EndAt) {
continue
}
matchesPlacement := false
if len(schedule.Placements) == 0 && placement == store.HeroPlacementHome {
matchesPlacement = true
}
for _, candidate := range schedule.Placements {
if candidate == placement {
matchesPlacement = true
break
}
}
if !matchesPlacement {
continue
}
if len(schedule.Weekdays) > 0 {
weekday := int(now.In(location).Weekday())
found := false