From 2a9948868f7d629c31c6539e5a1cf97646a891d7 Mon Sep 17 00:00:00 2001 From: saurabhbhatia Date: Wed, 11 Sep 2013 11:37:42 +0800 Subject: [PATCH] Updated import data controller to check the absense of title data --- .../admin/import_data_controller.rb | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/app/controllers/admin/import_data_controller.rb b/app/controllers/admin/import_data_controller.rb index c86df98b8..5b58e3122 100644 --- a/app/controllers/admin/import_data_controller.rb +++ b/app/controllers/admin/import_data_controller.rb @@ -14,25 +14,25 @@ class Admin::ImportDataController < OrbitBackendController @teacher_data = Hash.from_xml(res.body) @teachers = @teacher_data["objects"] - @i = 2000 + @i = 5000 @teachers.each do |hash| @roles = Role.all @teacher = User.new I18n.locale = :zh_tw - if hash['teacher_zh_tw'].blank? - @teacher.first_name = hash['teacher_en'] - elsif hash['teacher_zh_tw'].blank? && hash['teacher_en'].blank? - @teacher.first_name = "Please Fill the Name" + if hash['teacher_zh_tw'].blank? && hash['teacher_en'].blank? + @teacher.first_name = "Please Fill the Name" + elsif hash['teacher_zh_tw'].blank? && !hash['teacher_en'].blank? + @teacher.first_name = hash['teacher_en'] else - @teacher.first_name = hash['teacher_zh_tw'] + @teacher.first_name = hash['teacher_zh_tw'] end I18n.locale = :en - if hash['teacher_en'].blank? + if hash['teacher_zh_tw'].blank? && hash['teacher_en'].blank? + @teacher.first_name = "Please Fill the Name" + elsif hash['teacher_en'].blank? && !hash['teacher_zh_tw'].blank? @teacher.first_name = hash['teacher_zh_tw'] - elsif hash['teacher_zh_tw'].blank? && hash['teacher_en'].blank? - @teacher.first_name = "Please Fill the Name" else - @teacher.first_name = hash['teacher_en'] + @teacher.first_name = hash['teacher_en'] end #@teacher.first_name = hash['teacher_en']