-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improvements #9
base: master
Are you sure you want to change the base?
Improvements #9
Changes from 1 commit
8274bc3
17a3ea0
726d61a
c45e1e1
9f7bc88
dfbcc78
d409122
077a104
2ee35b3
9b83de9
ed5c9cb
e901b71
f4dbfe8
e3a0763
56c8b07
e64afd9
0596516
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,16 +14,16 @@ def start! | |
|
||
puts "Checking who was born today" | ||
unless birthdays.nil? | ||
users = "<@#{ birthdays[0] }>" | ||
users = "#{ mention birthdays[0] }" | ||
if birthdays.count > 1 | ||
puts "#{ birthdays.count } people were born today" | ||
if birthdays.count == 2 | ||
users = " <@#{ birthdays[0] }> and <@#{ birthdays[1] }> " | ||
users = " #{ mention birthdays[0] } and #{ mention birthdays[1] } " | ||
else | ||
for i in 1..birthdays.count-2 | ||
users += ", <@#{ birthdays[i] }>" | ||
users.concat( ", #{ mention birthdays[i] }" ) | ||
end | ||
users += " and <@#{ birthdays[i+1] }> " | ||
users.concat( " and #{ mention birthdays[i+1] } " ) | ||
end | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can simplify this:
What do you think ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @shinenelson Did you take a look at this ? (mentions are missing here) |
||
message = "#{users} #{@config.greeting_message}" | ||
|
@@ -35,4 +35,13 @@ def start! | |
puts "Today is a day that no one was born" | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have you looked at my previous comment with a suggestion to refactor this function ?
|
||
end | ||
|
||
def mention ( name ) | ||
if @config.mention | ||
"<@#{ name }>" | ||
else | ||
name | ||
end | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you give an example where disabling mentions is useful ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The earlier version of the database stored the real names of users. The bot wished users with their real names. So, I thought that could be a valid use-case But like my commit message said, some people might prefer wishing their team-mates by their real names (probably for more family-togetherness) and/or not choosing to spam the users with mentions on the wishes (but that wil probably be taken care of by other team-mates, anyway). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense, thanks ! |
||
|
||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should keep
Time.now
in the logThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, you wanted it in the log. The way I handle my
cron
s are, I prependdate
before my executing command. But I don't know if this works with Heroku's scheduler (does it?). Else I'll just put the date back in the log.