backlog 0.13.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +15 -1
- data/Rakefile +2 -0
- data/app/controllers/application.rb +3 -6
- data/app/controllers/backlogs_controller.rb +84 -4
- data/app/controllers/estimates_controller.rb +1 -5
- data/app/controllers/periods_controller.rb +84 -2
- data/app/controllers/tasks_controller.rb +0 -51
- data/app/controllers/works_controller.rb +7 -3
- data/app/helpers/application_helper.rb +9 -0
- data/app/helpers/backlogs_helper.rb +62 -0
- data/app/helpers/periods_helper.rb +63 -0
- data/app/helpers/tasks_helper.rb +0 -72
- data/app/models/period.rb +17 -7
- data/app/models/task.rb +11 -6
- data/app/views/backlogs/_buttons.rhtml +1 -0
- data/app/views/backlogs/_tasks.rhtml +9 -11
- data/app/views/backlogs/finish_task.rjs +3 -0
- data/app/views/backlogs/move_task_to_period.rjs +3 -0
- data/app/views/backlogs/reopen_task.rjs +3 -0
- data/app/views/{tasks/finish.rjs → periods/finish_task.rjs} +0 -0
- data/app/views/{tasks/move_to_period.rjs → periods/move_task_to_period.rjs} +0 -0
- data/app/views/{tasks/reopen.rjs → periods/reopen_task.rjs} +0 -0
- data/app/views/tasks/_completed.rhtml +10 -11
- data/app/views/tasks/_fields_header.rhtml +3 -3
- data/app/views/tasks/_task.rhtml +6 -6
- data/app/views/tasks/update_estimate.rjs +2 -0
- data/app/views/works/_form.rhtml +1 -1
- data/app/views/works/update_time.rjs +1 -1
- data/cruise_config.rb +1 -2
- data/test/functional/periods_controller_test.rb +116 -0
- data/test/functional/tasks_controller_test.rb +0 -116
- data/test/functional/works_controller_test.rb +9 -1
- data/test/performance/test_threaded.rb +38 -18
- metadata +9 -6
- data/app/views/estimates/create_ajax.rjs +0 -11
data/app/helpers/tasks_helper.rb
CHANGED
@@ -1,76 +1,4 @@
|
|
1
1
|
module TasksHelper
|
2
|
-
def remove_active_task(page)
|
3
|
-
page.visual_effect :blind_up, "task_#{@task.id}"
|
4
|
-
if @last_active_in_backlog
|
5
|
-
page["task_#{@task.id}"].ancestors.first.ancestors.first.remove
|
6
|
-
else
|
7
|
-
page.remove "task_#{@task.id}"
|
8
|
-
end
|
9
|
-
|
10
|
-
if @last_active
|
11
|
-
page.visual_effect :blind_up, "active_tasks"
|
12
|
-
page.visual_effect :appear, "no_tasks_message"
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def remove_finished_task(page)
|
17
|
-
page.visual_effect :fade, "task_#{@task.id}"
|
18
|
-
page.remove "task_#{@task.id}"
|
19
|
-
|
20
|
-
if @last_finished
|
21
|
-
page.select('#completed_tasks tr').first.remove
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def add_active_task(page)
|
26
|
-
if @task.lower_item.nil? || @task.lower_item.backlog != @task.backlog
|
27
|
-
page.insert_html :top, :active_tasks, '<table class="input" style="width: 100%;"/>'
|
28
|
-
elsif @task.lower_item
|
29
|
-
page.select('#active_tasks table tr').first.remove
|
30
|
-
page.select('#active_tasks table tr').first.remove
|
31
|
-
end
|
32
|
-
|
33
|
-
insert(page, render(:partial => "/tasks/task", :locals => { :task => @task, :i => 1, :active => true, :highlight_task => false, :update => :spotlight, :hidden => true }), '#active_tasks table')
|
34
|
-
|
35
|
-
fields_header = render(:partial => '/tasks/fields_header', :locals => { :backlog => @task.backlog, :active => true } )
|
36
|
-
insert(page, fields_header, '#active_tasks table')
|
37
|
-
insert(page, render(:partial => "/tasks/backlog_header", :locals => {:backlog => @task.backlog}), '#active_tasks table')
|
38
|
-
|
39
|
-
page[:no_tasks_message].hide
|
40
|
-
|
41
|
-
if @task.lower_item.nil?
|
42
|
-
page.visual_effect :appear, "active_tasks"
|
43
|
-
end
|
44
|
-
page.visual_effect :appear, "task_#{@task.id}"
|
45
|
-
end
|
46
|
-
|
47
|
-
def add_finished_task(page)
|
48
|
-
finished_count = Task.count(:conditions => ['period_id = ? AND finished_at IS NOT NULL', @task.period_id])
|
49
|
-
unless finished_count == 1
|
50
|
-
page.select('#completed_tasks tr').first.remove
|
51
|
-
end
|
52
|
-
|
53
|
-
page.insert_html :top, :completed_tasks, :partial => '/tasks/task', :locals => {:active => false, :hidden => true, :highlight_task => false}
|
54
|
-
page.visual_effect :appear, "task_#{@task.id}"
|
55
|
-
|
56
|
-
page.insert_html :top, :completed_tasks, :partial => '/tasks/fields_header', :locals => {:backlog => @task.backlog, :active => false}
|
57
|
-
end
|
58
|
-
|
59
|
-
def update_burn_down_chart(page)
|
60
|
-
if @task.period
|
61
|
-
page['burn_down_chart'].src = url_for(:controller => 'periods', :action => :burn_down_chart_thumbnail, :id => @task.period.id, :rnd => rand)
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def record(page, script)
|
66
|
-
page.call("#{script};//")
|
67
|
-
end
|
68
|
-
|
69
|
-
def insert(page, content, selector, position = :top)
|
70
|
-
escaped_content = content.gsub("\n", '').gsub("'", "\\\\'")
|
71
|
-
record(page, "new Insertion.#{position.to_s.capitalize}($$('#{selector}').first(), '#{escaped_content}')")
|
72
|
-
end
|
73
|
-
|
74
2
|
end
|
75
3
|
|
76
4
|
class Time
|
data/app/models/period.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
class Period < ActiveRecord::Base
|
2
2
|
include Localization
|
3
|
+
extend UserSystem
|
4
|
+
include UserSystem
|
3
5
|
|
4
6
|
belongs_to :party
|
5
7
|
acts_as_list :scope => :party, :order => :position
|
@@ -11,8 +13,13 @@ class Period < ActiveRecord::Base
|
|
11
13
|
errors.add "A period cannot end before it starts" unless end_on >= start_on
|
12
14
|
end
|
13
15
|
|
14
|
-
def self.find_active_or_future
|
15
|
-
find(:all, :conditions => "end_on >= '#{Date.today.strftime '%Y-%m-%d'}'")
|
16
|
+
def self.find_active_or_future(check_tasks = false)
|
17
|
+
periods = find(:all, :conditions => "end_on >= '#{Date.today.strftime '%Y-%m-%d'}'")
|
18
|
+
if (check_tasks)
|
19
|
+
ended_periods_with_open_tasks = Task.find(:all, :conditions => ['finished_at IS NULL AND period_id NOT IN (?)', periods.map{|p| p.id}]).map {|t| t.period}
|
20
|
+
periods + ended_periods_with_open_tasks
|
21
|
+
end
|
22
|
+
periods.select {|p| p.party.includes?(current_user)}
|
16
23
|
end
|
17
24
|
|
18
25
|
def speed
|
@@ -170,7 +177,7 @@ class Period < ActiveRecord::Base
|
|
170
177
|
def burn_down_graph(size)
|
171
178
|
begin
|
172
179
|
require 'gruff'
|
173
|
-
|
180
|
+
rescue MissingSourceFile => e
|
174
181
|
return File.read("public/images/rmagick_#{size}.gif") if File.exists? "public/images/rmagick_#{size}.gif"
|
175
182
|
return File.read("public/images/rmagick.gif")
|
176
183
|
end
|
@@ -190,19 +197,22 @@ class Period < ActiveRecord::Base
|
|
190
197
|
g.colors += %w{#8888ff #d7a790}
|
191
198
|
|
192
199
|
recorded_dates = self.recorded_dates
|
200
|
+
|
193
201
|
observed_todo_data = get_todo_data(recorded_dates)
|
194
|
-
actual_todo_data = get_todo_data(recorded_dates, true)
|
195
202
|
g.data("#{l :todo} (#{l :obs})", observed_todo_data)
|
203
|
+
g.data(l(:projection), projection_data(observed_todo_data))
|
204
|
+
|
205
|
+
actual_todo_data = get_todo_data(recorded_dates, true)
|
196
206
|
g.data("#{l :todo}", actual_todo_data)
|
207
|
+
g.data(l(:projection), projection_data(actual_todo_data))
|
208
|
+
|
197
209
|
g.data(l(:done), get_work_data(recorded_dates)) if track_work?
|
210
|
+
|
198
211
|
if previous_period = higher_item
|
199
212
|
g.data("#{l :previous_abr} #{l :obs}", previous_period.get_todo_data(previous_period.dates))
|
200
213
|
g.data("#{l :previous_abr}", previous_period.get_todo_data(previous_period.dates, true))
|
201
214
|
end
|
202
215
|
|
203
|
-
g.data(l(:projection), projection_data(observed_todo_data))
|
204
|
-
g.data(l(:projection), projection_data(actual_todo_data))
|
205
|
-
|
206
216
|
g.minimum_value = 0
|
207
217
|
|
208
218
|
all_dates = dates
|
data/app/models/task.rb
CHANGED
@@ -72,6 +72,10 @@ class Task < ActiveRecord::Base
|
|
72
72
|
|
73
73
|
def estimate(new_todo)
|
74
74
|
return unless new_todo && new_todo != ''
|
75
|
+
new_todo = new_todo.to_i
|
76
|
+
if new_todo == 0
|
77
|
+
finish(Task::COMPLETED, false)
|
78
|
+
end
|
75
79
|
previous_estimate = estimates.last
|
76
80
|
new_estimate = Estimate.new
|
77
81
|
if previous_estimate
|
@@ -134,6 +138,7 @@ class Task < ActiveRecord::Base
|
|
134
138
|
save!
|
135
139
|
children.each {|child_task| child_task.reopen}
|
136
140
|
end
|
141
|
+
self
|
137
142
|
end
|
138
143
|
|
139
144
|
def move_to_period(new_period)
|
@@ -167,8 +172,8 @@ class Task < ActiveRecord::Base
|
|
167
172
|
new_task.position = nil
|
168
173
|
new_task.save!
|
169
174
|
new_task.insert_at 1
|
170
|
-
# new_task.position = 1
|
171
|
-
# new_task.save!
|
175
|
+
# new_task.position = 1
|
176
|
+
# new_task.save!
|
172
177
|
new_task.estimate(old_todo)
|
173
178
|
end
|
174
179
|
else
|
@@ -208,7 +213,7 @@ class Task < ActiveRecord::Base
|
|
208
213
|
def active_children?
|
209
214
|
children.detect {|child| child.active?}
|
210
215
|
end
|
211
|
-
|
216
|
+
|
212
217
|
def finished?
|
213
218
|
completed?
|
214
219
|
end
|
@@ -329,7 +334,7 @@ class Task < ActiveRecord::Base
|
|
329
334
|
return if work_started?
|
330
335
|
open
|
331
336
|
new_work = works.new
|
332
|
-
|
337
|
+
|
333
338
|
# TODO (uwe): Only needed for rails 1.2.x branch. Remove when moving to 1.3 or 2.0.
|
334
339
|
new_work.task = self
|
335
340
|
|
@@ -371,7 +376,7 @@ class Task < ActiveRecord::Base
|
|
371
376
|
end
|
372
377
|
started_works.select {|work| work.user.nil?}.last
|
373
378
|
end
|
374
|
-
|
379
|
+
|
375
380
|
def description_with_parents
|
376
381
|
if parent.nil?
|
377
382
|
"#{backlog.name}: #{description}"
|
@@ -379,5 +384,5 @@ class Task < ActiveRecord::Base
|
|
379
384
|
"#{parent.description_with_parents} - #{description}"
|
380
385
|
end
|
381
386
|
end
|
382
|
-
|
387
|
+
|
383
388
|
end
|
@@ -1,3 +1,4 @@
|
|
1
1
|
<%=image_link_to 'arrow_up.png', l(:backlogs), :action => :list %>
|
2
2
|
<%=image_detour_to('clipboard.png', l(:edit), :controller => 'backlogs', :action => :edit, :id => @backlog)%>
|
3
3
|
<%=image_detour_to('clipboard.png', l(:show), :controller => 'backlogs', :action => :show, :id => @backlog)%>
|
4
|
+
<%=detour_to(image_tag(url_for("add.png"), :alt => l(:add_task), :title => l(:add_task), :class => 'image-submit'), :controller => 'tasks', :action => 'new', :task => {:backlog_id => @backlog.id} ) %>
|
@@ -5,19 +5,17 @@
|
|
5
5
|
</div>
|
6
6
|
|
7
7
|
<div id="active_tasks"<%=' style="display: none;"' unless @tasks and not @tasks.empty?%>>
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
<% current_period = @task.period %>
|
17
|
-
<% end %>
|
18
|
-
<%= render :partial => '/tasks/task/', :locals => {:task => @task, :i => i += 1, :active => true, :highlight_task => false, :update => :maincontent, :hidden => false} %>
|
8
|
+
<%#=render :partial => '/tasks/backlog_header', :locals => {:backlog => @backlog, :track_times => tasks.find {|t|t.period && t.period.active?}} %>
|
9
|
+
<% i = 0 %>
|
10
|
+
<% for period in @tasks.map {|t| t.period}.uniq %>
|
11
|
+
<table id="active_tasks_<%=period ? period.id : 'unplanned' %>">
|
12
|
+
<%=render :partial => '/tasks/period_header', :locals => {:period => period} %>
|
13
|
+
<%=render :partial => '/tasks/fields_header', :locals => {:backlog => @backlog, :active => true, :track_times => tasks.find {|t|t.period && t.period.active?}} %>
|
14
|
+
<% for @task in @tasks.select {|t| t.period_id == (period && period.id)} %>
|
15
|
+
<%=render :partial => '/tasks/task/', :locals => {:task => @task, :i => i += 1, :active => true, :highlight_task => false, :update => :maincontent, :hidden => false} %>
|
19
16
|
<% end %>
|
20
17
|
</table>
|
18
|
+
<% end %>
|
21
19
|
</div>
|
22
20
|
|
23
21
|
<p id="no_tasks_message"<%=' style="display: none;"' if @tasks and not @tasks.empty?%>><%=l :no_pending_tasks_in_backlog%></p>
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,13 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
<table id="
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
1
|
+
<div id="completed_tasks">
|
2
|
+
<% @completed_tasks.map {|t| t.period}.uniq.each do |period| %>
|
3
|
+
<table id="completed_tasks_<%=period.id%>" class="input">
|
4
|
+
<%= render :partial => '/tasks/period_header', :locals => {:period => period} unless @completed_tasks.map(&:period).uniq.size == 1 %>
|
5
|
+
<%= render :partial => '/tasks/fields_header', :locals => {:backlog => @backlog, :active => false, :track_times => false} %>
|
6
|
+
<% @completed_tasks.select {|t| t.period == period}.each do |task| %>
|
7
|
+
<%=render :partial => '/tasks/task', :locals => { :task => task, :i => i, :active => false, :highlight_task => task == @selected_task, :hidden => false } %>
|
8
|
+
<% i += 1 %>
|
9
9
|
<% end %>
|
10
|
-
<%=render :partial => '/tasks/task', :locals => { :task => task, :i => i, :active => false, :highlight_task => task == @selected_task, :hidden => false } %>
|
11
|
-
<% i += 1 %>
|
12
|
-
<% end %>
|
13
10
|
</table>
|
11
|
+
<% end %>
|
12
|
+
</div>
|
@@ -2,8 +2,8 @@
|
|
2
2
|
<th/>
|
3
3
|
<th align="center"><%=active ? '#' : l(:resolution_abr)%></th>
|
4
4
|
<th><%=l :task %></th>
|
5
|
-
<th><%=l :start if backlog.work_account && backlog.work_account.track_times? %></th>
|
5
|
+
<th><%=l :start if active && backlog.work_account && backlog.work_account.track_times? %></th>
|
6
6
|
<th/>
|
7
|
-
<th><%=l :done if backlog.track_done? %></th>
|
8
|
-
<th width="*"><%=l :todo if backlog.track_todo? %></th>
|
7
|
+
<th><%=l :done if not backlog or backlog.track_done? %></th>
|
8
|
+
<th width="*"><%=l :todo if active && backlog.track_todo? %></th>
|
9
9
|
</tr>
|
data/app/views/tasks/_task.rhtml
CHANGED
@@ -60,16 +60,16 @@
|
|
60
60
|
</td>
|
61
61
|
<td nowrap="true" width="1">
|
62
62
|
<% if active && @task.loggable? -%>
|
63
|
-
<% remote_form_for(:estimate, :url => {:
|
63
|
+
<% remote_form_for(:estimate, :url => {:action => :update_task_estimate, :id => @task}) do |f| -%>
|
64
64
|
<% if @task.track_todo? -%>
|
65
65
|
<% if @task.period.nil? || @task.period.active_or_future? -%>
|
66
|
-
<%=f.text_field :todo, :tabindex => i+2, :id => "#{@task.id}_todo", :value => @task.todo, :class => :task_hours, :maxlength => 4 %>
|
66
|
+
<%=f.text_field :todo, :tabindex => i+2, :id => "task_#{@task.id}_todo", :value => @task.todo, :class => :task_hours, :maxlength => 4 %>
|
67
67
|
<% else -%>
|
68
68
|
<%=@task.todo %>
|
69
69
|
<% end -%>
|
70
70
|
<% end -%>
|
71
71
|
<% if (not @task.track_times?) && !@task.work_started? && (@task.period.nil? || @task.period.active?) %>
|
72
|
-
<%=image_link_to_remote('checkmark.png', l(:complete), {:
|
72
|
+
<%=image_link_to_remote('checkmark.png', l(:complete), {:action => :finish_task, :id => @task}, nil, true)%>
|
73
73
|
<% end -%>
|
74
74
|
<% end -%>
|
75
75
|
<% end -%>
|
@@ -79,12 +79,12 @@
|
|
79
79
|
<% if @task.active? %>
|
80
80
|
<% if @task.loggable? %>
|
81
81
|
<% unless @task.work_started? %>
|
82
|
-
<%=image_link_to_remote('arrow_right.png', l(:move_to_next_period), {:
|
83
|
-
<%=image_link_to_remote('ernes_stop.png', l(:abort), {:
|
82
|
+
<%=image_link_to_remote('arrow_right.png', l(:move_to_next_period), {:action => :move_task_to_next_period, :id => @task}, nil, true)%>
|
83
|
+
<%=image_link_to_remote('ernes_stop.png', l(:abort), {:action => :abort_task, :id => @task}, nil, true)%>
|
84
84
|
<% end %>
|
85
85
|
<% end %>
|
86
86
|
<% elsif (@task.period.nil? || (not @task.period.passed?)) && @task.leaf? %>
|
87
|
-
<%=image_link_to_remote('eraser.png', l(:reopen), {:
|
87
|
+
<%=image_link_to_remote('eraser.png', l(:reopen), {:action => :reopen_task, :id => @task}, nil, true) %>
|
88
88
|
<% end -%>
|
89
89
|
<% end -%>
|
90
90
|
</td>
|
data/app/views/works/_form.rhtml
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
<h4><%=link_to @work.task.description, :controller => 'tasks', :action => :edit, :id => @work.task.id %></h4></p>
|
14
14
|
<%= hidden_field 'work', 'task_id' %>
|
15
15
|
<% else %>
|
16
|
-
<%= select 'work', 'task_id', @tasks.map{|task| [task.description_with_parents, task.id]}.sort %></p>
|
16
|
+
<%= select 'work', 'task_id', [['', '']] + @tasks.map{|task| [task.description_with_parents, task.id]}.sort %></p>
|
17
17
|
<% end %>
|
18
18
|
|
19
19
|
<% if @work.task.nil? || @work.task.track_times?%>
|
data/cruise_config.rb
CHANGED
@@ -121,4 +121,120 @@ class PeriodsControllerTest < Test::Unit::TestCase
|
|
121
121
|
assert_redirected_to ''
|
122
122
|
end
|
123
123
|
|
124
|
+
def test_move_task_to_next_period
|
125
|
+
before = Task.find(tasks(:another).id)
|
126
|
+
|
127
|
+
post :move_task_to_next_period, :id => tasks(:another).id
|
128
|
+
|
129
|
+
assert_response :success
|
130
|
+
|
131
|
+
after = Task.find(tasks(:another).id)
|
132
|
+
assert_equal tasks(:another).period_id, after.period_id
|
133
|
+
|
134
|
+
new_task = Task.find_by_period_id_and_previous_task_id(periods(:future).id, before.id)
|
135
|
+
assert_nil new_task.finished_at
|
136
|
+
assert_nil new_task.resolution
|
137
|
+
assert_equal 1, new_task.position
|
138
|
+
end
|
139
|
+
|
140
|
+
def test_move_task_to_next_period_from_past
|
141
|
+
task = tasks(:first)
|
142
|
+
before = Task.find(task.id)
|
143
|
+
|
144
|
+
post :move_task_to_next_period, :id => task.id
|
145
|
+
|
146
|
+
assert_response :success
|
147
|
+
|
148
|
+
after = Task.find(task.id)
|
149
|
+
assert_equal task.period_id, after.period_id
|
150
|
+
|
151
|
+
new_task = Task.find_by_period_id_and_previous_task_id(periods(:active).id, task.id)
|
152
|
+
assert_nil new_task.finished_at
|
153
|
+
assert_nil new_task.resolution
|
154
|
+
assert_equal 1, new_task.position
|
155
|
+
end
|
156
|
+
|
157
|
+
def test_move_to_next_period_at_end
|
158
|
+
before = Task.find(tasks(:in_last_period).id)
|
159
|
+
assert_equal tasks(:in_last_period).period_id, before.period_id
|
160
|
+
|
161
|
+
post :move_task_to_next_period, :id => tasks(:in_last_period).id
|
162
|
+
|
163
|
+
assert_response :success
|
164
|
+
|
165
|
+
before.reload
|
166
|
+
assert_equal tasks(:in_last_period).period_id, before.period_id
|
167
|
+
|
168
|
+
after = Task.find(tasks(:in_last_period).id)
|
169
|
+
assert_equal before.period_id, after.period_id
|
170
|
+
end
|
171
|
+
|
172
|
+
def test_move_to_next_period_from_ancient
|
173
|
+
before = tasks(:in_ancient)
|
174
|
+
previous_last_id = Task.find(:first, :order => 'id DESC').id
|
175
|
+
|
176
|
+
post :move_task_to_next_period, :id => before.id
|
177
|
+
|
178
|
+
assert_response :success
|
179
|
+
|
180
|
+
after = Task.find(before.id)
|
181
|
+
assert_equal before.period_id, after.period_id
|
182
|
+
assert_equal Task::POSTPONED, after.resolution
|
183
|
+
assert_not_nil after.finished_at
|
184
|
+
|
185
|
+
new = Task.find(:first, :order => 'id DESC', :conditions => "id > #{previous_last_id}")
|
186
|
+
assert_not_nil new
|
187
|
+
assert_equal before.id, new.previous_task_id
|
188
|
+
assert_equal 1, new.position
|
189
|
+
end
|
190
|
+
|
191
|
+
def test_move_task_to_period_back_to_earlier_period
|
192
|
+
task_to_move = tasks(:in_last_period)
|
193
|
+
target_task = tasks(:postponed)
|
194
|
+
target_period = periods(:active)
|
195
|
+
|
196
|
+
post :move_task_to_period, {"id"=> task_to_move.id,
|
197
|
+
"detour"=>{"action"=>"edit_no_layout", "id"=>"39", "controller"=>"backlogs"},
|
198
|
+
"period_id"=> target_period.id
|
199
|
+
}
|
200
|
+
|
201
|
+
old_task = Task.find(task_to_move.id)
|
202
|
+
assert_not_nil old_task.finished_at
|
203
|
+
assert_equal Task::POSTPONED, old_task.resolution
|
204
|
+
assert_nil old_task.position
|
205
|
+
|
206
|
+
new_task = Task.find(target_task.id)
|
207
|
+
new_task.reload
|
208
|
+
assert_nil new_task.finished_at
|
209
|
+
assert_nil new_task.resolution
|
210
|
+
assert_equal 1, new_task.position
|
211
|
+
end
|
212
|
+
|
213
|
+
def test_move_task_to_period
|
214
|
+
highest = Task.find(:first, :order => 'id DESC')
|
215
|
+
|
216
|
+
post :move_task_to_period, :id => "task_#{tasks(:another).id}",
|
217
|
+
:detour => {:action => 'show_no_layout', :id => periods(:active).id, :controller => 'periods'},
|
218
|
+
:period_id => periods(:future).id
|
219
|
+
|
220
|
+
new_task = Task.find(:first, :order => 'id DESC')
|
221
|
+
assert new_task.id != highest.id
|
222
|
+
assert_equal periods(:future).id, new_task.period_id
|
223
|
+
end
|
224
|
+
|
225
|
+
def test_move_task_to_period_past
|
226
|
+
post :move_task_to_period, :id => "task_#{tasks(:another).id}",
|
227
|
+
:detour => {:action => 'show_no_layout', :id => periods(:active).id, :controller => 'periods'},
|
228
|
+
:period_id => periods(:past).id
|
229
|
+
assert_equal periods(:active).id, tasks(:another).period_id
|
230
|
+
end
|
231
|
+
|
232
|
+
def test_abort_task
|
233
|
+
post :abort_task, :id => tasks(:first).id
|
234
|
+
|
235
|
+
after = Task.find(tasks(:first).id)
|
236
|
+
assert_not_nil after.finished_at
|
237
|
+
assert_equal Task::ABORTED, after.resolution
|
238
|
+
end
|
239
|
+
|
124
240
|
end
|