Signed-off-by: Benjamin LAN-SUN-LUK <benjamin.lan-sun-luk(a)supinfo.com>
---
app/controllers/items_controller.rb | 1 +
app/models/backlog_item.rb | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/app/controllers/items_controller.rb
b/app/controllers/items_controller.rb
index fa68ad0..902daf8 100644
--- a/app/controllers/items_controller.rb
+++ b/app/controllers/items_controller.rb
@@ -100,6 +100,7 @@ class ItemsController < ApplicationController
# GET /products/1/sprints/1/items/1/drop
def drop
+ raise "You cannot drop that backlog item because some tasks are against
it." unless @backlog_item.tasks.empty?
respond_to do |format|
if @backlog_item.can_drop?(@user)
@backlog_item.drop
diff --git a/app/models/backlog_item.rb b/app/models/backlog_item.rb
index 4fd4501..d962fda 100644
--- a/app/models/backlog_item.rb
+++ b/app/models/backlog_item.rb
@@ -152,7 +152,7 @@ class BacklogItem < ActiveRecord::Base
# Returns whether the user can drop this backlog item.
def can_drop?(user)
- (state == STATE_ASSIGNED) && owner?(user) && sprint.active?
+ (state == STATE_ASSIGNED) && owner?(user) && sprint.active?
&&
self.tasks.empty?
end
# Returns whether the user can complete this backlog item.
--
1.6.0.2
Show replies by date