Skip to content
Snippets Groups Projects
Unverified Commit c6021280 authored by Sébastien Gaya's avatar Sébastien Gaya
Browse files

dependencies program diploma

parent b7718f19
No related branches found
No related tags found
No related merge requests found
......@@ -49,15 +49,27 @@ class Education::Diploma < ApplicationRecord
}
end
def published_programs_for_website(website)
website.education_programs.published.where(diploma: self)
end
# We need to send the diplomas only to the websites that need them
def for_website?(website)
website.education_programs.published.where(diploma: self).any?
published_programs_for_website(website).any?
end
def git_path(website)
"content/diplomas/#{slug}/_index.html"
end
def git_dependencies(website)
published_programs = published_programs_for_website(website)
dependencies = [self]
dependencies += published_programs + published_programs.map(&:active_storage_blobs).flatten if published_programs.any?
dependencies
end
def to_s
"#{name}"
end
......
......@@ -210,7 +210,8 @@ class Education::Program < ApplicationRecord
university_people_through_role_involvements +
university_people_through_role_involvements.map(&:active_storage_blobs).flatten +
university_people_through_role_involvements.map(&:administrator) +
website.menus
website.menus +
[diploma]
end
def git_destroy_dependencies(website)
......
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