Skip to content
Snippets Groups Projects
Commit bfcb576d authored by Arnaud Levy's avatar Arnaud Levy
Browse files

import

parent 1d5375fb
No related branches found
No related tags found
No related merge requests found
...@@ -30,7 +30,7 @@ class University::Person::Alumnus::Import < ApplicationRecord ...@@ -30,7 +30,7 @@ class University::Person::Alumnus::Import < ApplicationRecord
def parse def parse
csv.each do |row| csv.each do |row|
row['program'] = '23279cab-8bc1-4c75-bcd8-1fccaa03ad55' #TMP local fix # row['program'] = '23279cab-8bc1-4c75-bcd8-1fccaa03ad55' #TMP local fix
program = university.education_programs program = university.education_programs
.find_by(id: row['program']) .find_by(id: row['program'])
next if program.nil? next if program.nil?
...@@ -59,19 +59,18 @@ class University::Person::Alumnus::Import < ApplicationRecord ...@@ -59,19 +59,18 @@ class University::Person::Alumnus::Import < ApplicationRecord
# TODO all fields # TODO all fields
# gender # gender
# birth # birth
# phonepro # phone_professional
# phoneperso # phone_personal
# address # address
# zipcode # zipcode
# city # city
# country # country
# status
person.is_alumnus = true person.is_alumnus = true
person.url = url person.url = url
person.slug = person.to_s.parameterize.dasherize person.slug = person.to_s.parameterize.dasherize
person.twitter ||= row['socialtwitter'] person.twitter ||= row['social_twitter']
person.linkedin ||= row['sociallinkedin'] person.linkedin ||= row['social_linkedin']
person.biography ||= row['status'] person.biography ||= row['biography']
person.phone ||= row['mobile'] person.phone ||= row['mobile']
byebug unless person.valid? byebug unless person.valid?
person.save person.save
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<% content_for :action_bar_left do %> <% content_for :action_bar_left do %>
<%= link_to t('import'), <%= link_to t('import'),
admin_university_person_alumnus_imports_path, new_admin_university_person_alumnus_import_path,
class: button_classes if can? :manage, University::Person::Alumnus::Import %> class: button_classes if can? :manage, University::Person::Alumnus::Import %>
<% end %> <% end %>
......
...@@ -58,11 +58,11 @@ ...@@ -58,11 +58,11 @@
<td>https://www.stephanedupond.fr</td> <td>https://www.stephanedupond.fr</td>
</tr> </tr>
<tr> <tr>
<th>phonepro</th> <th>phone_professional</th>
<td>+33 1 01 01 01 01</td> <td>+33 1 01 01 01 01</td>
</tr> </tr>
<tr> <tr>
<th>phoneperso</th> <th>phone_personal</th>
<td>+33 1 01 01 01 01</td> <td>+33 1 01 01 01 01</td>
</tr> </tr>
<tr> <tr>
...@@ -86,15 +86,15 @@ ...@@ -86,15 +86,15 @@
<td>FR</td> <td>FR</td>
</tr> </tr>
<tr> <tr>
<th>status</th> <th>biography</th>
<td>Product Designer</td> <td>Product Designer</td>
</tr> </tr>
<tr> <tr>
<th>socialtwitter</th> <th>social_twitter</th>
<td>stephanedupond</td> <td>stephanedupond</td>
</tr> </tr>
<tr> <tr>
<th>sociallinkedin</th> <th>social_linkedin</th>
<td>https://www.linkedin.com/in/stephanedupond</td> <td>https://www.linkedin.com/in/stephanedupond</td>
</tr> </tr>
</tbody> </tbody>
......
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