Project

General

Profile

« Previous | Next » 

Revision 957

Performance improvement on workflow setup screen.

View differences:

trunk/app/controllers/roles_controller.rb
94 94
    end
95 95
    @roles = Role.find(:all, :order => 'builtin, position')
96 96
    @trackers = Tracker.find(:all, :order => 'position')
97
    @statuses = IssueStatus.find(:all, :include => :workflows, :order => 'position')
97
    @statuses = IssueStatus.find(:all, :order => 'position')
98 98
  end
99 99
  
100 100
  def report    
trunk/app/views/roles/workflow.rhtml
35 35
	
36 36
	<% for old_status in @statuses %>
37 37
		<tr>
38
		<td><%= old_status.name %></td>		
39
		<% for new_status in @statuses %>
38
		<td><%= old_status.name %></td>
39
		<% new_status_ids_allowed = old_status.find_new_statuses_allowed_to(@role, @tracker).collect(&:id) -%>
40
		<% for new_status in @statuses -%>
40 41
			<td align="center">
41
      
42
     <input type="checkbox"
42
      <input type="checkbox"
43 43
      name="issue_status[<%= old_status.id %>][]"
44 44
      value="<%= new_status.id %>"
45
      <%if old_status.new_statuses_allowed_to(@role, @tracker).include? new_status%>checked="checked"<%end%>
46
      >			
45
      <%= 'checked="checked"' if new_status_ids_allowed.include? new_status.id %>>			
47 46
			</td>
48
		<% end %>		
49
		
47
		<% end -%>
50 48
		</tr>
51 49
	<% end %>
52 50
	</table>
trunk/db/migrate/085_add_role_tracker_old_status_index_to_workflows.rb
1
class AddRoleTrackerOldStatusIndexToWorkflows < ActiveRecord::Migration
2
  def self.up
3
    add_index :workflows, [:role_id, :tracker_id, :old_status_id], :name => :workflows_role_tracker_old_status
4
  end
5

  
6
  def self.down
7
    remove_index :workflows, :name => :workflows_role_tracker_old_status
8
  end
9
end
0 10

  

Also available in: Unified diff