Skip to content

Commit

Permalink
Drop the %s used in LIKE
Browse files Browse the repository at this point in the history
  • Loading branch information
iBug committed Apr 1, 2018
1 parent 1478f29 commit cd9c8e0
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions app/controllers/github_controller.rb
Expand Up @@ -75,9 +75,9 @@ def pull_request_hook
domain = domain[0]
domain.gsub! '\W', '[^A-Za-z0-9]'

num_tps = Post.where('body REGEXP ?', "%#{domain}%").where(is_tp: true).count
num_fps = Post.where('body REGEXP ?', "%#{domain}%").where(is_fp: true).count
num_naa = Post.where('body REGEXP ?', "%#{domain}%").where(is_naa: true).count
num_tps = Post.where('body REGEXP ?', "#{domain}").where(is_tp: true).count
num_fps = Post.where('body REGEXP ?', "#{domain}").where(is_fp: true).count
num_naa = Post.where('body REGEXP ?', "#{domain}").where(is_naa: true).count

response_text += get_line domain, num_tps, num_fps, num_naa
end
Expand All @@ -88,9 +88,9 @@ def pull_request_hook
keyword = keyword[0]
keyword.gsub! '\W', '[^A-Za-z0-9]'

num_tps = Post.where('body REGEXP ?', "%#{keyword}%").where(is_tp: true).count
num_fps = Post.where('body REGEXP ?', "%#{keyword}%").where(is_fp: true).count
num_naa = Post.where('body REGEXP ?', "%#{keyword}%").where(is_naa: true).count
num_tps = Post.where('body REGEXP ?', "#{keyword}").where(is_tp: true).count
num_fps = Post.where('body REGEXP ?', "#{keyword}").where(is_fp: true).count
num_naa = Post.where('body REGEXP ?', "#{keyword}").where(is_naa: true).count

response_text += get_line keyword, num_tps, num_fps, num_naa
end
Expand All @@ -101,9 +101,9 @@ def pull_request_hook
username = username[0]
username.gsub! '\W', '[^A-Za-z0-9]'

num_tps = Post.where('username REGEXP ?', "%#{username}%").where(is_tp: true).count
num_fps = Post.where('username REGEXP ?', "%#{username}%").where(is_fp: true).count
num_naa = Post.where('username REGEXP ?', "%#{username}%").where(is_naa: true).count
num_tps = Post.where('username REGEXP ?', "#{username}").where(is_tp: true).count
num_fps = Post.where('username REGEXP ?', "#{username}").where(is_fp: true).count
num_naa = Post.where('username REGEXP ?', "#{username}").where(is_naa: true).count

response_text += get_line username, num_tps, num_fps, num_naa
end
Expand All @@ -114,9 +114,9 @@ def pull_request_hook
watch = watch[0]
watch.gsub! '\W', '[^A-Za-z0-9]'

num_tps = Post.where('body REGEXP ?', "%#{watch}%").where(is_tp: true).count
num_fps = Post.where('body REGEXP ?', "%#{watch}%").where(is_fp: true).count
num_naa = Post.where('body REGEXP ?', "%#{watch}%").where(is_naa: true).count
num_tps = Post.where('body REGEXP ?', "#{watch}").where(is_tp: true).count
num_fps = Post.where('body REGEXP ?', "#{watch}").where(is_fp: true).count
num_naa = Post.where('body REGEXP ?', "#{watch}").where(is_naa: true).count

response_text += get_line watch, num_tps, num_fps, num_naa
end
Expand Down

0 comments on commit cd9c8e0

Please sign in to comment.