Skip to content

Instantly share code, notes, and snippets.

@rubyonrailsworks
Created November 12, 2012 05:11
Show Gist options
  • Select an option

  • Save rubyonrailsworks/4057624 to your computer and use it in GitHub Desktop.

Select an option

Save rubyonrailsworks/4057624 to your computer and use it in GitHub Desktop.
TaobaoOrder
# -*- encoding : utf-8 -*-
require "csv"
task :check_missing_tids => :environment do
missing_tids=[]
open("lib/data/ExportOrderList201211121238.csv").readlines.each do |line|
row = line.split(",")
tid = row[0].strip
order = TaobaoOrder.find_by_tid(tid)
unless order.present?
unless TaobaoOrder.find_by_tid tid
missing_tids << tid
puts "missing #{tid}"
end
end
puts missing_tids
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment