lecturer load lva load first steps

This commit is contained in:
Andreas Stephanides
2014-03-16 11:19:10 +01:00
parent bc455fcf06
commit 4ac7b41a7f
6 changed files with 36 additions and 9 deletions

View File

@@ -16,4 +16,16 @@ class Lecturer < ActiveRecord::Base
has_and_belongs_to_many :lvas
mount_uploader :picture, PictureUploader
resourcify
def load_tissdata
url= "https://tiss.tuwien.ac.at/adressbuch/adressbuch/person_via_oid/"+self.oid.to_s+".xml"
hash=Hash.from_xml(open(url).read)["tuvienna"]
self.name=hash["person"]["firstname"]+" "+hash["person"]["lastname"]
if hash["person"]["employee"]["employment"].is_a? Array
self.email= hash["person"]["employee"]["employment"].first["emails"]["email"].first
else
self.email= hash["person"]["employee"]["employment"]["emails"]["email"].first
end
self.link= "https://tiss.tuwien.ac.at/adressbuch/adressbuch/person_via_oid/"+self.oid.to_s
end
end

View File

@@ -87,7 +87,7 @@ class Lva < ActiveRecord::Base
# rescue OpenURI::HTTPError => e
# end
self.name=hash["course"]["title"][I18n.locale.to_s]
self.pruefungsinformation= hash["course"]["examinationModalities"][I18n.locale.to_s]
self.pruefungsinformation = hash["course"]["examinationModalities"][I18n.locale.to_s]
self.desc= hash["course"]["objective"][I18n.locale.to_s]+hash["course"]["teachingContent"][I18n.locale.to_s]
self.typ=hash["course"]["courseType"]
self.stunden=hash["course"]["weeklyHours"]