backlog 0.10.7 → 0.10.8
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +9 -0
- data/app/controllers/works_controller.rb +14 -8
- data/app/models/work.rb +9 -4
- data/app/views/works/daily_work_sheet.rhtml +14 -16
- data/bin/backlog +3 -2
- data/test/unit/work_test.rb +19 -1
- metadata +2 -2
data/History.txt
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
== 0.10.8 2007-09-27
|
2
|
+
|
3
|
+
=== Fixes
|
4
|
+
|
5
|
+
* Always make startup link in /etc/init.d even if it exists already
|
6
|
+
* Reduced output in the "backlog setup_unix" command to avoid clutter.
|
7
|
+
* Daily Time Sheet now allows adding work records. Edit still not working.
|
8
|
+
* Filtered work records in daily work sheet to only show records for the current user.
|
9
|
+
|
1
10
|
== 0.10.7 2007-09-26
|
2
11
|
|
3
12
|
=== Fixes
|
@@ -36,11 +36,14 @@ class WorksController < ApplicationController
|
|
36
36
|
backlog = Backlog.find_by_name(params[:work].delete(:backlog_name))
|
37
37
|
description = params[:work][:task_description]
|
38
38
|
task = Task.find_by_backlog_id_and_description(backlog.id, description)
|
39
|
-
params[:work][:task_id] =
|
39
|
+
params[:work][:task_id] = task.id
|
40
|
+
params[:work].delete(:task_description)
|
40
41
|
end
|
41
42
|
convert_hours_param
|
43
|
+
convert_start_time_param
|
42
44
|
@work = Work.new(params[:work])
|
43
45
|
@work.completed_at = Time.now unless @work.completed_at
|
46
|
+
@work.user_id = current_user.id
|
44
47
|
if @work.save!
|
45
48
|
flash[:notice] = 'Work was successfully created.'
|
46
49
|
else
|
@@ -88,10 +91,7 @@ class WorksController < ApplicationController
|
|
88
91
|
def daily_work_sheet
|
89
92
|
@date = (params[:id] && Date.parse(params[:id])) || Date.today
|
90
93
|
@periods = []
|
91
|
-
@works = Work.
|
92
|
-
:conditions => "started_at < '#{@date+1}' AND completed_at >= '#{@date}'",
|
93
|
-
:order => 'completed_at'
|
94
|
-
)
|
94
|
+
@works = Work.find_work_for_day @date
|
95
95
|
@started_works = Task.find_started
|
96
96
|
render :layout => 'wide'
|
97
97
|
end
|
@@ -120,8 +120,14 @@ class WorksController < ApplicationController
|
|
120
120
|
end
|
121
121
|
|
122
122
|
def auto_complete_for_work_task_description
|
123
|
-
|
124
|
-
|
123
|
+
if backlog_name = params[:backlog_name]
|
124
|
+
if backlog = Backlog.find_by_name(backlog_name)
|
125
|
+
backlog_clause = " AND backlog_id = #{backlog.id}"
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
@tasks = Task.find(:all,
|
130
|
+
:conditions => [ "finished_at IS NULL AND LOWER(description) LIKE ?#{backlog_clause}",
|
125
131
|
'%' + params[:work][:task_description].downcase + '%' ],
|
126
132
|
:order => 'description ASC',
|
127
133
|
:limit => 16)
|
@@ -134,7 +140,7 @@ class WorksController < ApplicationController
|
|
134
140
|
if params[:work] && params[:work][:started_at_time]
|
135
141
|
new_hour = params[:work][:started_at_time][0..1]
|
136
142
|
new_minutes = params[:work][:started_at_time][3..4]
|
137
|
-
if @work.started?
|
143
|
+
if @work && @work.started?
|
138
144
|
t = @work.started_at
|
139
145
|
else
|
140
146
|
t = Time.now
|
data/app/models/work.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
class Work < ActiveRecord::Base
|
2
2
|
extend UserSystem
|
3
3
|
include UserSystem
|
4
|
-
|
4
|
+
|
5
5
|
belongs_to :task
|
6
6
|
belongs_to :user
|
7
7
|
|
@@ -9,7 +9,7 @@ class Work < ActiveRecord::Base
|
|
9
9
|
validates_associated :task
|
10
10
|
validates_presence_of :started_at
|
11
11
|
validates_presence_of :user_id, :if => :validate_user?
|
12
|
-
|
12
|
+
|
13
13
|
def validate_user?
|
14
14
|
task.enable_users?
|
15
15
|
end
|
@@ -51,11 +51,11 @@ class Work < ActiveRecord::Base
|
|
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
55
|
works_for_day = works.select {|work| (work.task.backlog == backlog) && (work.started_at.to_date == (first + day)) && (work.user_id.nil? || (user && 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
|
+
|
59
59
|
invoice_day_total = invoice_works_for_day.reduce(BigDecimal('0')){|total, work| total += work.hours}
|
60
60
|
internal_day_total = internal_works_for_day.reduce(BigDecimal('0')){|total, work| total += work.hours}
|
61
61
|
totals_per_backlog[backlog.id][0] << invoice_day_total
|
@@ -68,6 +68,11 @@ class Work < ActiveRecord::Base
|
|
68
68
|
totals_per_backlog
|
69
69
|
end
|
70
70
|
|
71
|
+
def self.find_work_for_day date
|
72
|
+
Work.find(:all, :conditions => "started_at < '#{date+1}' AND completed_at >= '#{date}' AND user_id = #{current_user.id}",
|
73
|
+
:order => 'completed_at')
|
74
|
+
end
|
75
|
+
|
71
76
|
def started?
|
72
77
|
completed_at.nil?
|
73
78
|
end
|
@@ -22,7 +22,7 @@
|
|
22
22
|
<% end %>
|
23
23
|
<th><%=l :done %></th>
|
24
24
|
</tr>
|
25
|
-
|
25
|
+
|
26
26
|
<% day_total = 0 %>
|
27
27
|
<% for @work in @works %>
|
28
28
|
<% day_total += @work.hours if @work %>
|
@@ -43,19 +43,19 @@
|
|
43
43
|
<% if track_times %>
|
44
44
|
<td align="right">
|
45
45
|
<form>
|
46
|
-
<%=text_field :work, :
|
46
|
+
<%=text_field :work, :started_at_time, :value => (@work.started_at.strftime('%H:%M')), :class => 'task_time' %>
|
47
47
|
</form>
|
48
48
|
</td>
|
49
49
|
<td align="right">
|
50
50
|
<form>
|
51
|
-
<%=text_field :work, :
|
51
|
+
<%=text_field :work, :completed_at_time, :value => (@work.completed_at.strftime('%H:%M')), :class => 'task_time' %>
|
52
52
|
<%=image_button_to('arrow_right.png', l(:calculate), :controller => 'periods', :action => :show, :id => @work.task.period) %>
|
53
53
|
</form>
|
54
54
|
</td>
|
55
55
|
<% end %>
|
56
56
|
<td align="right">
|
57
57
|
<form>
|
58
|
-
<%=text_field :work, :
|
58
|
+
<%=text_field :work, :hours_time, :value => t(@work.hours), :class => 'task_hours' %>
|
59
59
|
</form>
|
60
60
|
</td>
|
61
61
|
</tr>
|
@@ -63,29 +63,29 @@
|
|
63
63
|
</table>
|
64
64
|
|
65
65
|
|
66
|
-
|
67
|
-
|
66
|
+
<% form_tag :controller => 'works', :action => 'create' do %>
|
67
|
+
<%=submit_tag('checkmark', :value => l(:save), :sstyle => 'display: none')%>
|
68
68
|
<%=hidden_field :work, :completed_at, :value => Time.now %>
|
69
69
|
<table sstyle="width: 100%" border="0">
|
70
70
|
<tr>
|
71
71
|
<td width="22"/>
|
72
72
|
<td>
|
73
|
-
<%=text_field_with_auto_complete :work, :backlog_name, {:value => '', :size => 16} %>
|
73
|
+
<%=text_field_with_auto_complete :work, :backlog_name, {:value => '', :size => 16}, {} %>
|
74
74
|
</td>
|
75
75
|
<td>
|
76
|
-
<%=text_field_with_auto_complete :work, :task_description, {:value => '', :size => 16, :class => :task_description} %>
|
76
|
+
<%=text_field_with_auto_complete :work, :task_description, {:value => '', :size => 16, :class => :task_description, :onfocus => "work_task_description_auto_completer.url = '#{url_for(:action => :auto_complete_for_work_task_description)}?backlog_name=' + $('work_backlog_name').value"}, :url => url_for({:action => :auto_complete_for_work_task_description, :backlog_name => "' + $('work_backlog_name').value + '", :escape => false}) %>
|
77
77
|
</td>
|
78
78
|
<% if track_times %>
|
79
79
|
<td align="right">
|
80
|
-
<%=text_field :work, :
|
80
|
+
<%=text_field :work, :started_at_time, :value => @work.started_at.strftime('%H:%M'), :class => 'task_time' %>
|
81
81
|
</td>
|
82
82
|
<td align="right">
|
83
|
-
<%=text_field :work, :
|
84
|
-
<%=image_button_to('arrow_right.png', l(:calculate), :controller => '
|
83
|
+
<%=text_field :work, :completed_at_time, :class => 'task_time', :value => @work.completed_at.strftime('%H:%M') %>
|
84
|
+
<%=image_button_to('arrow_right.png', l(:calculate), :controller => 'backlogs', :action => :show) %>
|
85
85
|
</td>
|
86
86
|
<% end %>
|
87
87
|
<td align="right">
|
88
|
-
|
88
|
+
<%=text_field :work, :hours_time, :value => t(@work.hours), :class => 'task_hours' %>
|
89
89
|
</td>
|
90
90
|
</tr>
|
91
91
|
<tr>
|
@@ -114,9 +114,7 @@
|
|
114
114
|
|
115
115
|
<script type="text/JavaScript">
|
116
116
|
//<!--
|
117
|
-
|
118
|
-
|
119
|
-
element.focus();
|
120
|
-
element.select();
|
117
|
+
$('work_backlog_name').focus();
|
118
|
+
$('work_backlog_name').select();
|
121
119
|
//-->
|
122
120
|
</script>
|
data/bin/backlog
CHANGED
@@ -54,14 +54,14 @@ when 'status'
|
|
54
54
|
when 'setup_unix'
|
55
55
|
current_user = `whoami`
|
56
56
|
users = `su - postgres -c "echo '\\du' | psql template1"`
|
57
|
-
puts users
|
58
57
|
unless users =~ /root/
|
58
|
+
puts users
|
59
59
|
createuser_command = `which createuser`.chomp
|
60
60
|
puts `su - postgres -c "#{createuser_command} -dAR #{current_user}"`
|
61
61
|
end
|
62
62
|
dbs = `su - postgres -c "echo '\\l' | psql template1"`
|
63
|
-
puts dbs
|
64
63
|
unless dbs =~ /#{APPLICATION}_production/
|
64
|
+
puts dbs
|
65
65
|
createdb_command = `which createdb`.chomp
|
66
66
|
puts `su - postgres -c "#{createdb_command} #{APPLICATION}_production"`
|
67
67
|
end
|
@@ -72,6 +72,7 @@ when 'setup_unix'
|
|
72
72
|
# TODO: provide startup information based on launchd in OS X versions >= 10.4
|
73
73
|
if File.directory? '/etc/init.d'
|
74
74
|
startup_app = "/etc/init.d/#{APPLICATION}"
|
75
|
+
File.delete startup_app if File.exists? startup_app
|
75
76
|
`ln -s #{Config::CONFIG['bindir']}/#{APPLICATION} #{startup_app}` unless File.exists? startup_app
|
76
77
|
end
|
77
78
|
FileUtils.cp "#{INSTALL_DIR}/etc/#{APPLICATION}.conf", config_file unless File.exists? config_file
|
data/test/unit/work_test.rb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../test_helper'
|
2
|
+
require 'user_system'
|
2
3
|
|
3
4
|
class WorkTest < Test::Unit::TestCase
|
4
|
-
|
5
|
+
include UserSystem
|
6
|
+
|
7
|
+
fixtures :users, :groups_users, :works
|
5
8
|
|
6
9
|
def test_work_totals_for_week
|
7
10
|
work_totals = Work.work_totals_for_week(24, 1000001)
|
@@ -18,4 +21,19 @@ class WorkTest < Test::Unit::TestCase
|
|
18
21
|
assert_equal 0, work_totals[1][1][5]
|
19
22
|
assert_equal 0, work_totals[1][1][6]
|
20
23
|
end
|
24
|
+
|
25
|
+
def test_find_work_for_day
|
26
|
+
Thread.current[:user] = users(:tesla)
|
27
|
+
assert_equal 1, Work.find_work_for_day(Date.parse('2007-06-12')).size
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
# TODO (uwe): This method should be removed
|
33
|
+
# It is here only because ClassTableInheritanceInRails broke reading fixtures by name
|
34
|
+
def users(login)
|
35
|
+
super(login)
|
36
|
+
end
|
37
|
+
|
38
|
+
|
21
39
|
end
|
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.
|
7
|
-
date: 2007-09-
|
6
|
+
version: 0.10.8
|
7
|
+
date: 2007-09-27 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
|