Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
Admin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
osuny
Admin
Commits
f309332d
Commit
f309332d
authored
3 years ago
by
Arnaud Levy
Browse files
Options
Downloads
Patches
Plain Diff
fix
parent
df6654c7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/models/university/person/alumnus/import.rb
+9
-8
9 additions, 8 deletions
app/models/university/person/alumnus/import.rb
with
9 additions
and
8 deletions
app/models/university/person/alumnus/import.rb
+
9
−
8
View file @
f309332d
...
...
@@ -62,23 +62,24 @@ class University::Person::Alumnus::Import < ApplicationRecord
.
first_or_create
first_name
=
clean_encoding
row
[
'first_name'
]
last_name
=
clean_encoding
row
[
'last_name'
]
email
=
row
[
'mail'
]
email
=
clean_encoding
(
row
[
'mail'
]).
to_s
.
downcase
url
=
clean_encoding
row
[
'url'
]
if
email
.
blank?
person
=
university
.
people
.
where
(
first_name:
first_name
,
last_name:
last_name
)
.
first_or_create
else
if
email
.
present?
person
=
university
.
people
.
where
(
email:
email
)
.
first_or_create
person
.
first_name
=
first_name
person
.
last_name
=
last_name
else
person
=
university
.
people
.
where
(
first_name:
first_name
,
last_name:
last_name
)
.
first_or_create
end
# TODO all fields
person
.
is_alumnus
=
true
person
.
url
=
url
person
.
slug
=
person
.
to_s
.
parameterize
person
.
slug
=
person
.
to_s
.
parameterize
.
dasherize
byebug
unless
person
.
valid?
person
.
save
cohort
.
people
<<
person
unless
person
.
in?
(
cohort
.
people
)
end
...
...
@@ -89,6 +90,6 @@ class University::Person::Alumnus::Import < ApplicationRecord
if
value
.
encoding
!=
'UTF-8'
value
=
value
.
force_encoding
'UTF-8'
end
value
value
.
strip
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment