backlog 0.10.4 → 0.10.5

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,4 +1,17 @@
1
- == 0.10.4 2007-09-25
1
+ == 0.10.5 2007-09-25
2
+
3
+ === Fixes
4
+
5
+ * Changed so that when specifying a task, only one subtask is created.
6
+ * Fixed bug in creation of estimates for subtasks.
7
+ * Corrected list work for period.
8
+ * Changed to group work done by start time instead of end time.
9
+ * Fixed bug in listing started subtasks.
10
+ * Added link to task from edit work view.
11
+ * Added backlog and super task names in drop down in new work view.
12
+ * Added edit link in weekly work sheet.
13
+
14
+ == 0.10.4 2007-09-24
2
15
 
3
16
  === Features
4
17
 
@@ -14,7 +14,7 @@ class EstimatesController < ApplicationController
14
14
  render :file => "public/500.html", :layout => true, :status => 500
15
15
  return
16
16
  end
17
- redirect_to :controller => 'periods', :action => :show, :id => @task.period, :task_id => @task.id
17
+ redirect_to :controller => 'periods', :action => :show, :id => @task.root_task.period, :task_id => @task.id
18
18
  else
19
19
  @task.errors.add :task, 'Estimate is missing.'
20
20
  render :file => "public/500.html", :layout => true, :status => 500
@@ -104,7 +104,7 @@ class PeriodsController < ApplicationController
104
104
 
105
105
  def list_work
106
106
  @period = Period.find(params[:id])
107
- @works = Work.find_by_sql("SELECT w.* FROM works w LEFT OUTER JOIN tasks t ON t.id = w.task_id WHERE t.period_id = #{@period.id} ORDER BY w.completed_at")
107
+ @works = @period.tasks.map {|t| t.works}.flatten.sort_by {|w| w.completed_at}
108
108
  render :template => '/works/list'
109
109
  end
110
110
 
@@ -274,7 +274,7 @@ class TasksController < ApplicationController
274
274
  parent_task = Task.find(params[:id])
275
275
  raise "Task is not open" unless parent_task.active? && (parent_task.period.nil? || parent_task.period.active_or_future?)
276
276
  if parent_task.children.empty?
277
- subtask_estimate = (parent_task.todo / 4).ceil
277
+ subtask_estimate = (parent_task.todo).ceil
278
278
  no_of_subtasks = (parent_task.todo / subtask_estimate).to_i
279
279
  subtask_estimate = parent_task.todo / no_of_subtasks
280
280
  (1..no_of_subtasks).each do |index|
@@ -57,6 +57,7 @@ class WorksController < ApplicationController
57
57
  @work = Work.find(params[:id])
58
58
  @work.attributes = params[:work]
59
59
  @estimate = Estimate.new(params[:estimate])
60
+ @tasks = Task.find_open
60
61
  @users = User.find(:all)
61
62
  end
62
63
 
@@ -8,7 +8,8 @@ class Estimate < ActiveRecord::Base
8
8
 
9
9
  validates_presence_of :task_id
10
10
  validates_associated :task
11
-
11
+ validates_presence_of :todo
12
+
12
13
  def after_create
13
14
  task.finish(Task::COMPLETED, false) if todo == 0
14
15
  end
data/app/models/task.rb CHANGED
@@ -52,14 +52,8 @@ class Task < ActiveRecord::Base
52
52
  user_clause = " OR user_id = #{current_user.id}"
53
53
  end
54
54
  conditions = "completed_at IS NULL AND (user_id IS NULL#{user_clause})"
55
- Work.find(:all, :conditions => conditions).map {|work| work.task}.sort do |t1, t2|
56
- if (backlog_sort = t1.backlog.name <=> t2.backlog.name) != 0
57
- backlog_sort
58
- elsif (period_sort = t1.period.end_on <=> t2.period.end_on) != 0
59
- period_sort
60
- else
61
- t1.position <=> t2.position
62
- end
55
+ Work.find(:all, :conditions => conditions).map {|work| work.task}.sort_by do |t|
56
+ [t.root_task.backlog.name, t.root_task.period.end_on, t.position || 0]
63
57
  end
64
58
  end
65
59
 
@@ -353,5 +347,13 @@ class Task < ActiveRecord::Base
353
347
  end
354
348
  started_works.select {|work| work.user.nil?}.last
355
349
  end
356
-
350
+
351
+ def description_with_parents
352
+ if parent.nil?
353
+ "#{backlog.name}: #{description}"
354
+ else
355
+ "#{parent.description_with_parents} - #{description}"
356
+ end
357
+ end
358
+
357
359
  end
data/app/models/work.rb CHANGED
@@ -28,10 +28,10 @@ class Work < ActiveRecord::Base
28
28
  def self.works_for_week(week_no, user = current_user)
29
29
  first = Date.commercial(Date.today.year, week_no, 1)
30
30
  last = first + 7
31
- works = find(:all, :conditions => "completed_at BETWEEN '#{first.to_time.iso8601}' AND '#{last.to_time.iso8601}'", :order => 'completed_at')
31
+ works = find(:all, :conditions => "completed_at IS NOT NULL AND started_at BETWEEN '#{first.to_time.iso8601}' AND '#{last.to_time.iso8601}'", :order => 'started_at')
32
32
  length = 0
33
33
  works_per_day = (0..6).map do |day|
34
- works_for_day = works.select {|work| work.completed_at.to_date == (first + day) && (work.user_id.nil? || (user && work.user_id == user.id)) }
34
+ works_for_day = works.select {|work| work.started_at.to_date == (first + day) && (work.user_id.nil? || (user && work.user_id == user.id)) }
35
35
  length = [length, works_for_day.length].max
36
36
  works_for_day
37
37
  end
@@ -47,12 +47,12 @@ class Work < ActiveRecord::Base
47
47
  def self.work_totals_for_week(week_no, user_id = current_user)
48
48
  first = Date.commercial(Date.today.year, week_no, 1)
49
49
  last = first + 7
50
- works = find(:all, :conditions => "completed_at BETWEEN '#{first.to_time.iso8601}' AND '#{last.to_time.iso8601}'", :order => 'completed_at')
50
+ works = find(:all, :conditions => "completed_at IS NOT NULL AND started_at BETWEEN '#{first.to_time.iso8601}' AND '#{last.to_time.iso8601}'", :order => 'started_at')
51
51
  totals_per_backlog = {}
52
52
  Backlog.find(:all).each do |backlog|
53
53
  totals_per_backlog[backlog.id] = [[], []]
54
54
  (0..6).each do |day|
55
- works_for_day = works.select {|work| (work.task.backlog == backlog) && (work.completed_at.to_date == (first + day)) && (user_id && work.user_id == user_id) }
55
+ works_for_day = works.select {|work| (work.task.backlog == backlog) && (work.started_at.to_date == (first + day)) && (user_id && work.user_id == user_id) }
56
56
  invoice_works_for_day = works_for_day.select {|work| work.invoice? }
57
57
  internal_works_for_day = works_for_day.select {|work| !work.invoice? }
58
58
 
@@ -47,7 +47,7 @@ function handleEvent(field, event, id) {
47
47
  <% end %>
48
48
  <% if task.period != current_period %>
49
49
  <tr><th colspan="6"><%=task.period ? h(task.period.name) : l(:unplanned_tasks)%></th></tr>
50
- <%= render :partial => '/tasks/fields_header', :locals => {:backlog => task.backlog, :active => true, :track_times => @tasks.find {|t|t.period && t.period.active?}} %>
50
+ <%= render :partial => '/tasks/fields_header', :locals => {:backlog => task.root_task.backlog, :active => true, :track_times => @tasks.find {|t|t.period && t.period.active?}} %>
51
51
  <% current_period = task.period %>
52
52
  <% end %>
53
53
  <%=render :partial => 'task', :locals => { :task => task, :i => i, :active => true, :highlight_task => (task == @selected_task), :update => :spotlight } %>
@@ -4,10 +4,10 @@
4
4
 
5
5
  <p><%=l :task%>:<br/>
6
6
  <% if @work.task %>
7
- <h4><%= @work.task.description %></h4></p>
7
+ <h4><%=link_to @work.task.description, :controller => 'tasks', :action => :edit, :id => @work.task.id %></h4></p>
8
8
  <%= hidden_field 'work', 'task_id' %>
9
9
  <% else %>
10
- <%= select 'work', 'task_id', @tasks.map{|task| [task.description, task.id]} %></p>
10
+ <%= select 'work', 'task_id', @tasks.map{|task| [task.description_with_parents, task.id]}.sort %></p>
11
11
  <% end %>
12
12
 
13
13
  <% if @work.task.nil? || @work.task.track_times?%>
@@ -58,6 +58,7 @@ end %>]
58
58
  <%=link_to(h(@work.task.period.name), :controller => 'periods', :action => :show, :id => @work.task.period) if @work.task.period %>
59
59
  <%=link_to(h(@work.task.root_task.backlog.name), :controller => 'backlogs', :action => :show, :id => @work.task.root_task.backlog) %>
60
60
  <%=link_to(h(@work.task.description), :controller => 'periods', :action => :show, :id => @work.task.period, :task_id => @work.task.id) %>
61
+ <%=link_to(l(:edit), :controller => 'works', :action => :edit, :id => @work.id) %>
61
62
  </td>
62
63
  <% if invoicing %>
63
64
  <td id="invoice_<%=@work.id%>">
data/lang/en.yaml CHANGED
@@ -21,6 +21,7 @@ daily_work_sheet: Daily work sheet
21
21
  delete: Delete
22
22
  done: Done
23
23
  down: Down
24
+ edit: Edit
24
25
  editing: Editing
25
26
  enable_customer: Enable customer
26
27
  enable_invoicing: Enable invoicing
data/lang/no.yaml CHANGED
@@ -21,6 +21,7 @@ daily_work_sheet: Timeføringsskjema
21
21
  delete: Slett
22
22
  done: Utført
23
23
  down: Ned
24
+ edit: Rediger
24
25
  editing: Redigerer
25
26
  enable_customer: Tillat kunder
26
27
  enable_invoicing: Tillat fakturering
@@ -7,3 +7,4 @@ two:
7
7
  id: 2
8
8
  created_at: 2007-06-11T13:45:00
9
9
  task_id: 2
10
+ todo: 40
@@ -110,7 +110,10 @@ class TasksControllerTest < Test::Unit::TestCase
110
110
  end
111
111
 
112
112
  def test_specify
113
- post :specify, "id"=>"2"
113
+ post :specify, "id" => tasks(:another).id.to_s
114
+
115
+ after = Task.find(tasks(:another))
116
+ assert_equal 1, after.children.size
114
117
  end
115
118
 
116
119
  def test_specify_passed_period
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: backlog
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.10.4
7
- date: 2007-09-24 00:00:00 +02:00
6
+ version: 0.10.5
7
+ date: 2007-09-25 00:00:00 +02:00
8
8
  summary: Application to aid collecting, processing, organizing, reviewing and doing tasks.
9
9
  require_paths:
10
10
  - lib