Pluralize (or not) 'Stars'

This commit is contained in:
Brian Buller 2020-12-02 08:45:51 -06:00
parent cf18b7a1a3
commit 24c7c80fbb

View File

@ -368,10 +368,14 @@ func (s *AoCState) AoCBoardCheckAndUpdate(yr int) {
continue
}
if mbr.Stars != v.Stars {
plural := "star"
if v.Stars > 1 {
plural = "stars"
}
if yr == s.GetLatestYear() {
s.SendSlackMessage(fmt.Sprintf(":christmas_tree: %s now has %d stars! :christmas_tree:", v.Name, v.Stars), channelId)
s.SendSlackMessage(fmt.Sprintf(":christmas_tree: %s now has %d %s! :christmas_tree:", v.Name, v.Stars, plural), channelId)
} else {
s.SendSlackMessage(fmt.Sprintf(":christmas_tree: %s now has %d stars! (%d) :christmas_tree:", v.Name, v.Stars, yr), channelId)
s.SendSlackMessage(fmt.Sprintf(":christmas_tree: %s now has %d %s! (%d) :christmas_tree:", v.Name, v.Stars, plural, yr), channelId)
}
}
}