Skip to content

Commit 88c30dd

Browse files
Auto create PBI is done
1 parent 52ea75a commit 88c30dd

File tree

2 files changed

+3
-17
lines changed

2 files changed

+3
-17
lines changed

app/controllers/scrum_controller.rb

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -101,23 +101,7 @@ def new_pbi
101101
end
102102

103103
def create_pbi
104-
begin
105-
@continue = !(params[:create_and_continue].nil?)
106-
@top = !(params[:top].nil?)
107-
@pbi = Issue.new
108-
@pbi.project = @project
109-
@pbi.author = User.current
110-
@pbi.tracker_id = params[:issue][:tracker_id]
111-
update_attributes(@pbi, params)
112-
if @top
113-
@pbi.set_on_top
114-
@pbi.save!
115-
end
116-
@pbi.sprint = @sprint
117-
@pbi.save!
118-
rescue Exception => @exception
119-
logger.error("Exception: #{@exception.inspect}")
120-
end
104+
create_pbi_auto(params)
121105
respond_to do |format|
122106
format.js
123107
end

app/controllers/sprints_controller.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ def create
5959
raise 'Fail to update project with product backlog' unless @project.save!
6060
end
6161
flash[:notice] = l(:notice_successful_create)
62+
pbi_params = {"issue"=>{"tracker_id"=> Tracker.find_by_name('Product Backlog').id, "sprint_id"=> @sprint.id, "subject"=>"#{@sprint.name} pbi", "status_id"=> IssueStatus.find_by_name('In Progress').id , "priority_id"=> Enumeration.find_by_name('Normal').id, "assigned_to_id"=>"", "start_date"=>@sprint.sprint_start_date, "due_date"=>@sprint.sprint_end_date, "estimated_hours"=>"", "done_ratio"=>"0", "custom_field_values"=>{ "#{CustomField.find_by_name('Story Points').id}"=>"#{CustomField.find_by_name('Story Points').default_value}"}, "description"=>""}}
63+
create_pbi_auto(pbi_params)
6264
redirect_back_or_default settings_project_path(@project, :tab => 'sprints')
6365
else
6466
render :action => :new

0 commit comments

Comments
 (0)