Project

General

Profile

To do #1284 » scrum_cache_16_2.patch

Angelinsky7 Angelinsky7, 2017-01-10 16:06

View differences:

app/views/post_its/sprint_board/_pbi_row.html.erb (working copy)
11 11
          |other| "pbi_#{pbi.id}_status_#{other.id}"
12 12
        } -%>
13 13
    <td id="<%= pbi_status_id %>" class="sprint-board">
14
      <% cache [ "v2", pbi, status ] do %>
14 15
      <%- tasks[status.id].each do |task| -%>
15 16
        <%= render :partial => 'post_its/sprint_board/task', :formats => [:html],
16 17
                   :locals => {:project => project,
......
19 20
                               :other_pbi_status_ids => other_pbi_status_ids,
20 21
                               :read_only => false} %>
21 22
      <%- end -%>
23
      <% end %>
22 24
    </td>
23 25
    <%= render :partial => 'post_its/sprint_board/pbi_status', :formats => [:js],
24 26
               :locals => {:project => project,
app/views/post_its/sprint_board/_task.html.erb (working copy)
1 1
<%- task_id = "task_#{task.id}" -%>
2
<% cache [ "v1", task ] do %>
2 3
<table id="<%= task_id %>" class="<%= task.post_it_css_class(:rotate => true, :scale => true, :draggable => true) %>"
3 4
       old-status="<%= task.status.id %>">
4 5
  <tr>
......
64 65
    </td>
65 66
  </tr>
66 67
</table>
68
<% end %>
67 69

  
68 70
<%= render :partial => "post_its/sprint_board/task", :formats => [:js],
69 71
           :locals => {:project => project,
app/views/sprints/show.html.erb (working copy)
8 8
           :locals => {:project => @project, :sprint => @sprint, :path => method(:sprint_path)} %>
9 9

  
10 10
<%- sprint_board_id = 'sprint_board' -%>
11

  
12
<% cache [ "v3", @sprint ] do %>
13

  
11 14
<table class="sprint-board">
12 15
  <thead class="sprint-board">
13 16
    <tr class="sprint-board">
......
27 30
  </tbody>
28 31
</table>
29 32

  
33
<% end %>
34

  
30 35
<%- if User.current.allowed_to?(:add_issues, @project) and
31 36
       User.current.allowed_to?(:edit_sprint_board, @project) and
32 37
       @sprint.open? -%>
init.rb (working copy)
24 24
Query.send(:include, Scrum::QueryPatch)
25 25
Tracker.send(:include, Scrum::TrackerPatch)
26 26
User.send(:include, Scrum::UserPatch)
27
TimeEntry.send(:include, Scrum::TimeEntryPatch)
27 28

  
28 29
require_dependency 'scrum/helper_hooks'
29 30
require_dependency 'scrum/view_hooks'
lib/scrum/issue_patch.rb (working copy)
12 12
    def self.included(base)
13 13
      base.class_eval do
14 14

  
15
        belongs_to :sprint
15
        belongs_to :sprint, :touch => true
16 16
        has_many :pending_efforts, -> { order('date ASC') }
17 17

  
18 18
        acts_as_list :scope => :sprint
......
35 35
          (issue.status_id_changed? or issue.new_record?) and
36 36
          issue.is_task? and !issue.parent_id.nil?
37 37
        }
38
        before_save :touch_sprint, :if => lambda { |issue|
39
          issue.project.scrum?
40
        }
41
        before_save :touch_parent_pbi, :if => lambda { |issue|
42
          issue.project.scrum? and issue.is_task? and !issue.parent_id.nil?
43
        }
38 44

  
39 45
        def has_story_points?
40 46
          ((!((custom_field_id = Scrum::Setting.story_points_custom_field_id).nil?)) and
......
390 396
          end
391 397
        end
392 398

  
399
        def touch_sprint
400
          if sprint
401
            sprint.touch
402
            sprint.save!
403
          end
404
          if (old_sprint = Sprint.find_by_id(sprint_id_was))
405
            old_sprint.touch
406
            old_sprint.save!
407
          end
408
        end
409

  
410
        def touch_parent_pbi
411
          pbi = self.parent
412
          if pbi and pbi.is_pbi?
413
            pbi.touch
414
            pbi.save!
415
          end
416
        end
417

  
393 418
        def min_position
394 419
          min = nil
395 420
          unless sprint.nil?
lib/scrum/time_entry_patch.rb (working copy)
1
# Copyright © Emilio González Montaña
2
# Licence: Attribution & no derivates
3
#   * Attribution to the plugin web page URL should be done if you want to use it.
4
#     https://redmine.ociotec.com/projects/redmine-plugin-scrum
5
#   * No derivates of this plugin (or partial) are allowed.
6
# Take a look to licence.txt file at plugin root folder for further details.
7

  
8
require_dependency 'time_entry'
9

  
10
module Scrum
11
  module TimeEntryPatch
12
    def self.included(base)
13
      base.class_eval do
14

  
15
        before_save :touch_issue, :if => lambda { |issue|
16
          issue.project.scrum?
17
        }
18

  
19
      private
20

  
21
        def touch_issue
22
          if issue
23
            issue.touch
24
            issue.save!
25
          end
26
        end
27

  
28
      end
29
    end
30
  end
31
end
(2-2/2)