Updated import data controller to check the absense of title data
This commit is contained in:
parent
e4514a353a
commit
2a9948868f
|
@ -14,23 +14,23 @@ 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?
|
||||
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']
|
||||
end
|
||||
I18n.locale = :en
|
||||
if hash['teacher_en'].blank?
|
||||
@teacher.first_name = hash['teacher_zh_tw']
|
||||
elsif hash['teacher_zh_tw'].blank? && 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']
|
||||
else
|
||||
@teacher.first_name = hash['teacher_en']
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue