From 2357de5b900cc73a355ec7a90f0ae922c6ef652b Mon Sep 17 00:00:00 2001 From: "revelaction (aider)" <96388231+revelaction@users.noreply.github.com> Date: Sat, 26 Oct 2024 20:35:52 +0200 Subject: [PATCH] refactor: use pickModuloProp for comment selection in buildNotificationCommentCategories --- ical/parse.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ical/parse.go b/ical/parse.go index 4dedd8f..5252718 100644 --- a/ical/parse.go +++ b/ical/parse.go @@ -261,9 +261,10 @@ func (p *Parser) buildNotificationCommentCategories(n notify.Notification, event } } - // Randomly select one Comment + // Select one Comment using pickModuloProp if len(comments) > 0 { - n.Comment = comments[rand.Intn(len(comments))] + commentIndex := pickModuloProp(et.interval, len(comments), et.dtStart) + n.Comment = comments[commentIndex] } // Assign collected categories to the Notification property