From 45b703fd33f25c9777cffa6778ed5474fab3a467 Mon Sep 17 00:00:00 2001 From: Sean Davis Date: Mon, 27 Jul 2026 08:02:56 -0600 Subject: [PATCH] Filter past events out of the homepage carousel top_events() sorted events by start date and took the last five with no date filter, so the homepage advertised conferences that had already finished (currently including EuroBioC2025). Its siblings upcoming_events() and previous_events() both filter on e[:end]; this one did not. Apply the same filter, and switch sorted[-5..-1] to last(5): the slice returns nil when fewer than five elements remain, which the filter now makes reachable. Fixes #401 Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01YBSvPwEk6sH1rhGmjPmsFq --- lib/helpers.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/helpers.rb b/lib/helpers.rb index cc79c50b..9400c720 100644 --- a/lib/helpers.rb +++ b/lib/helpers.rb @@ -453,7 +453,13 @@ def top_events(events) sorted = events.children.sort do |a, b| a[:start] <=> b[:start] end - toplist = sorted[-5..-1] + upcoming = sorted.select do |e| + e[:end] >= Time.now.to_date + end + # last(5) rather than [-5..-1]: the latter returns nil when fewer than five + # events remain, which is now reachable because the filter above can leave + # any number of them. + toplist = upcoming.last(5) toplist.reverse end