#3178: using blocks_ids instead of blocks in impediment management, hence removing overhead

pull/6827/head
Jens Ulferts 14 years ago
parent 0815343b31
commit e619bfb20b
  1. 4
      app/helpers/rb_common_helper.rb
  2. 6
      app/models/impediment.rb
  3. 2
      app/views/rb_impediments/_impediment.html.erb
  4. 2
      app/views/rb_taskboards/show.html.erb
  5. 12
      spec/models/impediment_spec.rb

@ -9,8 +9,8 @@ module RbCommonHelper
story.blank? || story.assigned_to.blank? ? "" : "#{story.assigned_to.firstname} #{story.assigned_to.lastname}"
end
def blocked_ids(blocked)
blocked.map{|b| b.id }.join(',')
def blocks_ids(ids)
ids.sort.join(',')
end
def build_inline_style(task)

@ -5,7 +5,7 @@ class Impediment < Task
after_save :update_blocks_list
safe_attributes "blocks", #change to blocks_ids once ui can be manipulated
safe_attributes "blocks_ids",
:if => lambda {|impediment, user|
(impediment.new_record? && user.allowed_to?(:create_impediments, impediment.project)) ||
user.allowed_to?(:update_impediments, impediment.project)
@ -30,10 +30,6 @@ class Impediment < Task
super(since, project_id, true)
end
def blocks=(ids)
self.blocks_ids = ids
end
def blocks_ids=(ids)
@blocks_ids_list = [ids] if ids.is_a?(Integer)
@blocks_ids_list = ids.split(/\D+/).map{|id| id.to_i} if ids.is_a?(String)

@ -4,7 +4,7 @@
<div class="v"><%= id_or_empty(impediment) %></div>
</div>
<div class="subject editable" fieldtype="textarea" fieldname="subject"><%= impediment.subject %></div>
<div class="blocks editable" fieldname="blocks"><%= blocked_ids(impediment.blocks) %></div>
<div class="blocks editable" fieldname="blocks_ids"><%= blocks_ids(impediment.blocks_ids) %></div>
<div class="assigned_to_id editable" fieldtype="select" fieldname="assigned_to_id">
<div class="t"><%= assignee_name_or_empty(impediment) %></div>
<div class="v"><%= assignee_id_or_empty(impediment) %></div>

@ -98,7 +98,7 @@
<%= render :partial => "rb_tasks/task", :object => Task.new %>
</div>
<div id="impediment_template">
<%= render :partial => "rb_impediments/impediment", :object => Task.new %>
<%= render :partial => "rb_impediments/impediment", :object => Impediment.new %>
</div>
<div id="issue_editor"> </div>

@ -94,7 +94,7 @@ describe Impediment do
feature.save
@impediment = Impediment.create_with_relationships({:subject => @impediment_subject,
:assigned_to_id => user.id,
:blocks => feature.id.to_s,
:blocks_ids => feature.id.to_s,
:status_id => issue_status1.id,
:fixed_version_id => version.id},
project.id)
@ -112,7 +112,7 @@ describe Impediment do
feature.save
@impediment = Impediment.create_with_relationships({:subject => @impediment_subject,
:assigned_to_id => user.id,
:blocks => feature.id.to_s,
:blocks_ids => feature.id.to_s,
:status_id => issue_status1.id,
:fixed_version_id => version.id},
project.id)
@ -128,7 +128,7 @@ describe Impediment do
before(:each) do
@impediment = Impediment.create_with_relationships({:subject => @impediment_subject,
:assigned_to_id => user.id,
:blocks => "",
:blocks_ids => "",
:status_id => issue_status1.id,
:fixed_version_id => version.id},
project.id)
@ -196,7 +196,7 @@ describe Impediment do
@story.fixed_version = version
@story.save
@blocks = @story.id.to_s
@impediment.update_with_relationships({:blocks => @blocks,
@impediment.update_with_relationships({:blocks_ids => @blocks,
:status_id => issue_status1.id.to_s})
end
@ -209,7 +209,7 @@ describe Impediment do
@story.fixed_version = Factory.create(:version, :project => project, :name => "another version")
@story.save
@blocks = @story.id.to_s
@impediment.update_with_relationships({:blocks => @blocks,
@impediment.update_with_relationships({:blocks_ids => @blocks,
:status_id => issue_status1.id.to_s})
end
@ -222,7 +222,7 @@ describe Impediment do
describe "WITHOUT a blocking relationship defined" do
before(:each) do
@blocks = ""
@impediment.update_with_relationships({:blocks => @blocks,
@impediment.update_with_relationships({:blocks_ids => @blocks,
:status_id => issue_status1.id.to_s})
end

Loading…
Cancel
Save