Project

General

Profile

Defect #1158 » fix_sprint_update_also_changes_children_v3.patch

Christian Luginbühl, 2016-05-26 17:59

View differences:

app/controllers/scrum_controller.rb (working copy)
382 382
    issue.init_journal(User.current)
383 383
    issue.sprint = sprint
384 384
    issue.save!
385
    issue.children.each do |child|
386
      unless child.closed?
387
        move_issue_to_sprint(child, sprint)
388
      end
389
    end
390 385
  end
391 386

  
392 387
end
lib/scrum/issue_patch.rb (working copy)
21 21

  
22 22
        before_save :update_position, :if => lambda {|issue| issue.sprint_id_changed? and issue.is_pbi?}
23 23

  
24
        before_save :update_sprint_of_children, :if => lambda {|issue| issue.sprint_id_changed? and issue.is_pbi?}
25

  
26
        # Overruling the filter in the base class with a condition to prevent
27
        # stale object update because of recursive child and parent "save"s.
28
        after_save :update_parent_attributes, :if => lambda {|issue| issue.is_pbi?}
29

  
24 30
        def has_story_points?
25 31
          ((!((custom_field_id = Scrum::Setting.story_points_custom_field_id).nil?)) and
26 32
           visible_custom_field_values.collect{|value| value.custom_field.id.to_s}.include?(custom_field_id))
......
320 326
          end
321 327
        end
322 328

  
329
        def update_sprint_of_children
330
          self.children.each do |child|
331
            unless child.closed?
332
              child.init_journal(User.current)
333
              child.sprint = self.sprint
334
              child.save!
335
            end
336
          end
337
        end
338
        
323 339
        def self.doer_or_reviewer_post_it_css_class(type)
324 340
          classes = ["post-it"]
325 341
          case type
(3-3/3)