From: Jean-Philippe Lang Date: Fri, 7 Dec 2007 11:19:30 +0000 (+0000) Subject: Performance improvement on workflow setup screen. X-Git-Tag: 0.6.1~10 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5e38bd93634b9135e5f294ec1823e8a6b04c3b64;p=redmine.git Performance improvement on workflow setup screen. git-svn-id: http://redmine.rubyforge.org/svn/trunk@957 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/controllers/roles_controller.rb b/app/controllers/roles_controller.rb index 3b5766aaf..a8a31cd4d 100644 --- a/app/controllers/roles_controller.rb +++ b/app/controllers/roles_controller.rb @@ -94,7 +94,7 @@ class RolesController < ApplicationController end @roles = Role.find(:all, :order => 'builtin, position') @trackers = Tracker.find(:all, :order => 'position') - @statuses = IssueStatus.find(:all, :include => :workflows, :order => 'position') + @statuses = IssueStatus.find(:all, :order => 'position') end def report diff --git a/app/views/roles/workflow.rhtml b/app/views/roles/workflow.rhtml index 2bc2abd51..0a435744f 100644 --- a/app/views/roles/workflow.rhtml +++ b/app/views/roles/workflow.rhtml @@ -35,18 +35,16 @@ <% for old_status in @statuses %> - <%= old_status.name %> - <% for new_status in @statuses %> + <%= old_status.name %> + <% new_status_ids_allowed = old_status.find_new_statuses_allowed_to(@role, @tracker).collect(&:id) -%> + <% for new_status in @statuses -%> - - checked="checked"<%end%> - > + <%= 'checked="checked"' if new_status_ids_allowed.include? new_status.id %>> - <% end %> - + <% end -%> <% end %> diff --git a/db/migrate/085_add_role_tracker_old_status_index_to_workflows.rb b/db/migrate/085_add_role_tracker_old_status_index_to_workflows.rb new file mode 100644 index 000000000..523cf091b --- /dev/null +++ b/db/migrate/085_add_role_tracker_old_status_index_to_workflows.rb @@ -0,0 +1,9 @@ +class AddRoleTrackerOldStatusIndexToWorkflows < ActiveRecord::Migration + def self.up + add_index :workflows, [:role_id, :tracker_id, :old_status_id], :name => :workflows_role_tracker_old_status + end + + def self.down + remove_index :workflows, :name => :workflows_role_tracker_old_status + end +end