Skip to content

Commit

Permalink
Don't search for \W, got for [ -] instead
Browse files Browse the repository at this point in the history
  • Loading branch information
iBug committed Mar 17, 2018
1 parent 7071018 commit 1b74ee2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/controllers/github_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def pull_request_hook

keywords.each do |keyword|
keyword = keyword[0]
keyword.gsub! '\W', '[ -]'

num_tps = Post.where('body LIKE ?', "%#{keyword}%").where(is_tp: true).count
num_fps = Post.where('body LIKE ?', "%#{keyword}%").where(is_fp: true).count
Expand All @@ -97,6 +98,7 @@ def pull_request_hook

usernames.each do |username|
username = username[0]
username.gsub! '\W', '[ -]'

num_tps = Post.where('username LIKE ?', "%#{username}%").where(is_tp: true).count
num_fps = Post.where('username LIKE ?', "%#{username}%").where(is_fp: true).count
Expand All @@ -109,6 +111,7 @@ def pull_request_hook

watches.each do |watch|
watch = watch[0]
watch.gsub! '\W', '[ -]'

num_tps = Post.where('body LIKE ?', "%#{watch}%").where(is_tp: true).count
num_fps = Post.where('body LIKE ?', "%#{watch}%").where(is_fp: true).count
Expand All @@ -123,7 +126,7 @@ def pull_request_hook
end

def get_line(thing, num_tps, num_fps, num_naa)
response_text = "#{thing} has been seen in #{num_tps} true #{'positive'.pluralize(num_tps)}"
response_text = "`#{thing}` has been seen in #{num_tps} true #{'positive'.pluralize(num_tps)}"
response_text += ", #{num_fps} false #{'positive'.pluralize(num_fps)}"
response_text += ", and #{num_naa} #{'NAA'.pluralize(num_naa)}."
response_text + "\n\n"
Expand Down

0 comments on commit 1b74ee2

Please sign in to comment.