Skip to content

Commit

Permalink
refactor: use pickModuloProp for comment selection in buildNotificati…
Browse files Browse the repository at this point in the history
…onCommentCategories
  • Loading branch information
revelaction committed Oct 26, 2024
1 parent 6d32f37 commit 2357de5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ical/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2357de5

Please sign in to comment.