Skip to content

Commit

Permalink
[ifmeorg#1713] added gsub! to account for special characters but stil…
Browse files Browse the repository at this point in the history
…l need to fix code
  • Loading branch information
S-Warmenhoven committed Apr 8, 2020
1 parent d0f4959 commit ebb575d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/services/resource_recommendation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,15 @@ def resources
moment_keywords.push(moment_name, moment_why, moment_fix)
moment_keywords = moment_keywords.flatten
moment_keywords = moment_keywords.map(&:downcase)
moment_keywords.each do |keyword|
keyword.gsub!(/([_@#!%()\-=;><,{}\~\[\]\.\/\?\"\*\^\$\+\-]+)/, ' ')
end
all_resources.each do |resource|
unless (resource['tags'] & moment_keywords).empty?
resource_tags = resource['tags']
resource_tags.each do |tag|
tag.gsub!(/([_@#!%()\-=;><,{}\~\[\]\.\/\?\"\*\^\$\+\-]+)/, ' ')
end
unless (resource_tags & moment_keywords).empty?
matched_resources.push(resource)
end
end
Expand Down

0 comments on commit ebb575d

Please sign in to comment.