# encoding: utf-8 

namespace :nccu_data do
  desc "load nccu data from csv"
  task :setup_ut_list => :environment do
    require 'csv'
    CSV.foreach("vendor/built_in_modules/announcement/lib/ut_list_from_nccu_2012feb.csv") do |row|
      new_unit = UnitListForAnc.new(:order => row[0], :ut_code => row[1], :up_ut_code => row[2], :created_at => Time.now,:updated_at => Time.now)
      #    order,ut_code,up_tu_code,ut_zh_tw,ut_en
      new_unit.build_title :en => row[4], :zh_tw => row[3]
      new_unit.save
    end

  end
end