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

sync program when teacher/role/person is commited

parent f71f7f20
No related branches found
No related tags found
No related merge requests found
......@@ -28,6 +28,8 @@ class Education::Program::Role < ApplicationRecord
has_many :people, class_name: 'Education::Program::Role::Person', dependent: :destroy
has_many :university_people, through: :people, source: :person
after_commit :sync_program
def to_s
"#{title}"
end
......@@ -37,4 +39,8 @@ class Education::Program::Role < ApplicationRecord
def last_ordered_element
program.roles.ordered.last
end
def sync_program
program.sync_with_git
end
end
......@@ -24,6 +24,9 @@ class Education::Program::Role::Person < ApplicationRecord
belongs_to :person, class_name: 'University::Person'
belongs_to :role, class_name: 'Education::Program::Role'
delegate :program, to: :role
after_commit :sync_program
def to_s
person.to_s
......@@ -34,4 +37,8 @@ class Education::Program::Role::Person < ApplicationRecord
def last_ordered_element
role.people.ordered.last
end
def sync_program
program.sync_with_git
end
end
......@@ -27,7 +27,15 @@ class Education::Program::Teacher < ApplicationRecord
scope :ordered, -> { joins(:person).order('university_people.last_name, university_people.first_name') }
after_commit :sync_program
def to_s
person.to_s
end
protected
def sync_program
program.sync_with_git
end
end
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