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
fc89c0ed
Commit
fc89c0ed
authored
2 years ago
by
Arnaud Levy
Browse files
Options
Downloads
Patches
Plain Diff
Wip #431
parent
cbdf10ac
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/education/program/with_websites.rb
+17
-6
17 additions, 6 deletions
app/models/education/program/with_websites.rb
db/schema.rb
+18
-1
18 additions, 1 deletion
db/schema.rb
with
35 additions
and
7 deletions
app/models/education/program/with_websites.rb
+
17
−
6
View file @
fc89c0ed
...
@@ -4,18 +4,29 @@ module Education::Program::WithWebsites
...
@@ -4,18 +4,29 @@ module Education::Program::WithWebsites
included
do
included
do
attr_accessor
:skip_websites_categories_callback
attr_accessor
:skip_websites_categories_callback
after_save_commit
:set_websites_categories
,
unless: :skip_websites_categories_callback
after_save_commit
:set_websites_categories
,
unless: :skip_websites_categories_callback
# FIXME incorrect, forgets websites about programs
has_many
:websites
,
->
{
distinct
},
through: :schools
has_many
:website_categories
,
has_many
:website_categories
,
class_name:
'Communication::Website::Category'
,
class_name:
'Communication::Website::Category'
,
dependent: :destroy
dependent: :destroy
end
end
def
websites
@websites
||=
university
.
websites
.
reject
do
|
website
|
website_concerned
=
false
# Site de formation
website_concerned
=
true
if
website
.
about
==
self
# Site d'école
if
website
.
about
&
.
is_a?
Education
::
School
# Formation dispensée dans l'école
website_concerned
=
true
if
self
.
in?
website
.
about
.
programs
end
!
website_concerned
end
end
def
set_websites_categories
def
set_websites_categories
websites
.
find_each
(
&
:
set_programs_categories!
)
websites
.
each
{
|
website
|
website
.
set_programs_categories!
}
end
end
end
end
This diff is collapsed.
Click to expand it.
db/schema.rb
+
18
−
1
View file @
fc89c0ed
...
@@ -504,6 +504,23 @@ ActiveRecord::Schema.define(version: 2022_06_09_085535) do
...
@@ -504,6 +504,23 @@ ActiveRecord::Schema.define(version: 2022_06_09_085535) do
t
.
index
[
"university_id"
],
name:
"index_education_schools_on_university_id"
t
.
index
[
"university_id"
],
name:
"index_education_schools_on_university_id"
end
end
create_table
"external_organizations"
,
id: :uuid
,
default:
->
{
"gen_random_uuid()"
},
force: :cascade
do
|
t
|
t
.
string
"title"
t
.
text
"description"
t
.
string
"address"
t
.
string
"zipcode"
t
.
string
"city"
t
.
string
"country"
t
.
string
"website"
t
.
string
"phone"
t
.
string
"mail"
t
.
boolean
"active"
t
.
string
"sirene"
t
.
integer
"kind"
t
.
datetime
"created_at"
,
precision:
6
,
null:
false
t
.
datetime
"updated_at"
,
precision:
6
,
null:
false
end
create_table
"imports"
,
id: :uuid
,
default:
->
{
"gen_random_uuid()"
},
force: :cascade
do
|
t
|
create_table
"imports"
,
id: :uuid
,
default:
->
{
"gen_random_uuid()"
},
force: :cascade
do
|
t
|
t
.
integer
"number_of_lines"
t
.
integer
"number_of_lines"
t
.
jsonb
"processing_errors"
t
.
jsonb
"processing_errors"
...
@@ -698,8 +715,8 @@ ActiveRecord::Schema.define(version: 2022_06_09_085535) do
...
@@ -698,8 +715,8 @@ ActiveRecord::Schema.define(version: 2022_06_09_085535) do
t
.
string
"linkedin"
t
.
string
"linkedin"
t
.
boolean
"is_alumnus"
,
default:
false
t
.
boolean
"is_alumnus"
,
default:
false
t
.
text
"description_short"
t
.
text
"description_short"
t
.
boolean
"is_author"
t
.
string
"name"
t
.
string
"name"
t
.
boolean
"is_author"
t
.
integer
"gender"
t
.
integer
"gender"
t
.
date
"birthdate"
t
.
date
"birthdate"
t
.
string
"phone_professional"
t
.
string
"phone_professional"
...
...
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