Created
June 22, 2016 17:47
-
-
Save LBRapid/eb72feccca9eb4a25963819729f5642e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ClipartDiagnoser | |
def call | |
CSV.open("/u01/app/jsLab_server/current/tmp/clipart_designs.csv", "wb") do |csv| | |
csv << ["design_id"] | |
Design.where(updated_at: (Time.now - 24.hours)..Time.now).find_each do |design| | |
xml = Nokogiri::XML(design.content) | |
clipart = xml.xpath("//icon[@grayscale='none' and @type='IMAGE']") | |
if clipart.present? | |
clipart.each do |clip| | |
colors = clip.xpath("//color") | |
if colors.length > 1 | |
csv << [design.id] | |
end | |
end | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment