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
fd80b2d8
Unverified
Commit
fd80b2d8
authored
3 years ago
by
Sébastien Gaya
Browse files
Options
Downloads
Patches
Plain Diff
check github valid, descendent has websites & programs path child
parent
ba1f515c
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/concerns/with_github_files.rb
+8
-6
8 additions, 6 deletions
app/models/concerns/with_github_files.rb
app/models/education/program.rb
+4
-1
4 additions, 1 deletion
app/models/education/program.rb
with
12 additions
and
7 deletions
app/models/concerns/with_github_files.rb
+
8
−
6
View file @
fd80b2d8
...
...
@@ -63,15 +63,17 @@ module WithGithubFiles
end
def
publish_github_files_with_descendents
list_of_websites
.
each
do
|
website
|
website_github
=
Github
.
with_website
website
list_of_websites
.
each
do
|
current_website
|
website_github
=
Github
.
with_website
current_website
next
unless
website_github
.
valid?
target_github_files
=
[]
github_manifest
.
each
do
|
manifest_item
|
github_file
=
github_files
.
where
(
website:
website
,
manifest_identifier:
manifest_item
[
:identifier
]).
first_or_create
github_file
=
github_files
.
where
(
website:
current_
website
,
manifest_identifier:
manifest_item
[
:identifier
]).
first_or_create
target_github_files
<<
github_file
github_file
.
add_to_batch
(
website_github
)
descendents
.
each
do
|
descendent
|
descendent_github_file
=
descendent
.
github_files
.
where
(
website:
website
,
manifest_identifier:
manifest_item
[
:identifier
]).
first_or_create
next
unless
descendent
.
list_of_websites
.
include?
current_website
descendent_github_file
=
descendent
.
github_files
.
where
(
website:
current_website
,
manifest_identifier:
manifest_item
[
:identifier
]).
first_or_create
target_github_files
<<
descendent_github_file
descendent_github_file
.
add_to_batch
(
website_github
)
end
...
...
@@ -85,9 +87,9 @@ module WithGithubFiles
end
def
unpublish_github_files
list_of_websites
.
each
do
|
website
|
list_of_websites
.
each
do
|
current_
website
|
github_manifest
.
each
do
|
manifest_item
|
github_files
.
find_by
(
website:
website
,
manifest_identifier:
manifest_item
[
:identifier
])
&
.
unpublish
github_files
.
find_by
(
website:
current_
website
,
manifest_identifier:
manifest_item
[
:identifier
])
&
.
unpublish
end
end
end
...
...
This diff is collapsed.
Click to expand it.
app/models/education/program.rb
+
4
−
1
View file @
fd80b2d8
...
...
@@ -114,7 +114,10 @@ class Education::Program < ApplicationRecord
end
def
update_children_paths
children
.
each
(
&
:save
)
children
.
each
do
|
child
|
child
.
update_column
:path
,
child
.
generated_path
child
.
update_children_paths
end
end
def
list_of_other_programs
...
...
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