Skip to content
Snippets Groups Projects
Commit 1552b0b5 authored by pabois's avatar pabois
Browse files

alumni imports

parent 7fcd9d50
No related branches found
No related tags found
No related merge requests found
......@@ -16,7 +16,10 @@ module Importers
@hash = hash
@error = nil
extract_person_variables
person.save if valid?
if valid?
person.save
add_picture_if_possible!(person)
end
end
def valid?
......@@ -33,7 +36,6 @@ module Importers
end
def person
# TODO: photo
@person ||= begin
if @email.present?
person = @university.people
......@@ -105,5 +107,17 @@ module Importers
end
end
def add_picture_if_possible!(person)
return if @photo.nil?
return if @person.picture.attached?
return unless @photo.end_with?('.jpg') || @photo.end_with?('.png')
begin
file = URI.open @photo
filename = File.basename @photo
person.picture.attach(io: file, filename: filename)
rescue
end
end
end
end
......@@ -23,7 +23,6 @@ module Importers
@hash = hash
@error = nil
extract_variables
# person.add_to_cohort cohort if valid?
end
def valid?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment