diff --git a/db/seeds/alternate_names_201410.csv b/db/seeds/alternate_names_201410.csv index 0430b5c2d..2a48911c1 100644 --- a/db/seeds/alternate_names_201410.csv +++ b/db/seeds/alternate_names_201410.csv @@ -1,4 +1,3 @@ -Id,Name,Alternate names (comma separated) 1,achiote,"aploppas, uruku" 2,ackee,"achee, ackee apple, akee" 267,acorn squash,"pepper squash, Des Moines squash" @@ -380,4 +379,4 @@ Id,Name,Alternate names (comma separated) ,Palmers Amaranth,"Palmer amaranth, Palmer's pigweed, carelessweed" ,Red-Root Amaranth,"redroot pigweed, red-rooted pigweed, common amaranth, pigweed amaranth, common tumbleweed" ,Spiny Amaranth,"prickly amaranth, thorny amaranth" -,Tandaljo,"Tandalja bhaji, callaloo, Joseph's coat " \ No newline at end of file +,Tandaljo,"Tandalja bhaji, callaloo, Joseph's coat " diff --git a/lib/tasks/growstuff.rake b/lib/tasks/growstuff.rake index c702052c9..479fd9f4e 100644 --- a/lib/tasks/growstuff.rake +++ b/lib/tasks/growstuff.rake @@ -279,22 +279,14 @@ namespace :growstuff do cropbot = Member.find_by_login_name("cropbot") CSV.foreach(file) do |row| crop_id, crop_name, alternate_names = row - if crop_name.blank? or alternate_names.blank? then + if alternate_names.blank? then next end - crop = Crop.find_by_name(crop_name) - if crop.nil? then - puts "Couldn't find crop #{crop_name}" - next - end - if crop.id.to_s != crop_id then - puts "crop #{crop} has ID #{crop.id}, expected #{crop_id}" - end alternate_names.split(/,\s*/).each do |an| puts "Adding alternate name '#{an}' to #{crop}" AlternateName.create( name: an, - crop_id: crop.id, + crop_id: crop_id, creator_id: cropbot.id ) end