Class: Mumuki::Classroom::Event::ProgressTransfer::Base
- Inherits:
-
Object
- Object
- Mumuki::Classroom::Event::ProgressTransfer::Base
- Defined in:
- lib/mumuki/classroom/event/progress_transfer/base.rb
Instance Attribute Summary collapse
-
#indicator ⇒ Object
readonly
Returns the value of attribute indicator.
-
#source_organization ⇒ Object
readonly
Returns the value of attribute source_organization.
Instance Method Summary collapse
- #execute! ⇒ Object
-
#initialize(indicator, source_organization, destination_organization) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(indicator, source_organization, destination_organization) ⇒ Base
Returns a new instance of Base.
4 5 6 7 8 |
# File 'lib/mumuki/classroom/event/progress_transfer/base.rb', line 4 def initialize(indicator, source_organization, destination_organization) @indicator = indicator @source_organization = source_organization @destination_organization = destination_organization end |
Instance Attribute Details
#indicator ⇒ Object (readonly)
Returns the value of attribute indicator.
2 3 4 |
# File 'lib/mumuki/classroom/event/progress_transfer/base.rb', line 2 def indicator @indicator end |
#source_organization ⇒ Object (readonly)
Returns the value of attribute source_organization.
2 3 4 |
# File 'lib/mumuki/classroom/event/progress_transfer/base.rb', line 2 def source_organization @source_organization end |
Instance Method Details
#execute! ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/mumuki/classroom/event/progress_transfer/base.rb', line 10 def execute! raise ActiveRecord::RecordNotFound, "Mumuki::Classroom::Student not found" unless old_student && new_student new_student.destroy_progress_for_guide!(indicator.content) destination_organization.switch! indicator.assignments.each do |assignment| transfer_sibling_for(assignment)&.update! organization: destination_organization.name, course: new_course, guide: guide_h end transfer_guide_progress! update_student!(old_student) update_student!(new_student) end |