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
805fbe12
Unverified
Commit
805fbe12
authored
2 years ago
by
Sébastien Gaya
Browse files
Options
Downloads
Patches
Plain Diff
orga from extranet
parent
e3809bfd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/models/university/organization.rb
+2
-0
2 additions, 0 deletions
app/models/university/organization.rb
app/models/university/person/experience.rb
+4
-5
4 additions, 5 deletions
app/models/university/person/experience.rb
with
6 additions
and
5 deletions
app/models/university/organization.rb
+
2
−
0
View file @
805fbe12
...
...
@@ -74,6 +74,8 @@ class University::Organization < ApplicationRecord
}
validates_presence_of
:name
# Organization can be created from extranet with only their name. Be careful for future validators.
# There is an attribute accessor above : `created_from_extranet`
enum
kind:
{
company:
10
,
...
...
This diff is collapsed.
Click to expand it.
app/models/university/person/experience.rb
+
4
−
5
View file @
805fbe12
...
...
@@ -50,11 +50,10 @@ class University::Person::Experience < ApplicationRecord
def
create_organization_if_needed
if
organization
.
nil?
&&
organization_name
.
present?
self
.
organization_name
=
self
.
organization_name
.
strip
self
.
organization
=
university
.
organizations
.
where
(
"name ILIKE ?"
,
organization_name
)
.
or
(
university
.
organizations
.
where
(
siren:
organization_name
)).
first_or_create
do
|
organization
|
organization
.
created_from_extranet
=
true
end
orga
=
university
.
organizations
.
find_by
(
"name ILIKE ?"
,
organization_name
)
orga
||=
university
.
organizations
.
find_by
(
siren:
organization_name
)
orga
||=
university
.
organizations
.
create
(
name:
organization_name
,
created_from_extranet:
true
)
self
.
organization
=
orga
if
orga
.
persisted?
end
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