Skip to content

Instantly share code, notes, and snippets.

@LBRapid
Created June 22, 2016 17:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LBRapid/eb72feccca9eb4a25963819729f5642e to your computer and use it in GitHub Desktop.
Save LBRapid/eb72feccca9eb4a25963819729f5642e to your computer and use it in GitHub Desktop.
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