Patch #1582 » add_time_spent_column_to_issues_and_colored-svn_r2823.patch
| app/helpers/issues_helper.rb (working copy) | ||
|---|---|---|
| 149 | 149 |
l(:field_due_date), |
| 150 | 150 |
l(:field_done_ratio), |
| 151 | 151 |
l(:field_estimated_hours), |
| 152 |
l(:field_spent_hours), |
|
| 152 | 153 |
l(:field_created_on), |
| 153 | 154 |
l(:field_updated_on) |
| 154 | 155 |
] |
| ... | ... | |
| 175 | 176 |
format_date(issue.due_date), |
| 176 | 177 |
issue.done_ratio, |
| 177 | 178 |
issue.estimated_hours.to_s.gsub('.', decimal_separator),
|
| 179 |
issue.spent_hours, |
|
| 178 | 180 |
format_time(issue.created_on), |
| 179 | 181 |
format_time(issue.updated_on) |
| 180 | 182 |
] |
| app/helpers/queries_helper.rb (working copy) | ||
|---|---|---|
| 52 | 52 |
progress_bar(value, :width => '80px') |
| 53 | 53 |
when :fixed_version |
| 54 | 54 |
link_to(h(value), { :controller => 'versions', :action => 'show', :id => issue.fixed_version_id })
|
| 55 |
when :spent_hours |
|
| 56 |
return issue.send :spent_hours_colored, value |
|
| 55 | 57 |
else |
| 56 | 58 |
h(value) |
| 57 | 59 |
end |
| app/models/issue.rb (working copy) | ||
|---|---|---|
| 231 | 231 |
# spent_hours => 0 |
| 232 | 232 |
# spent_hours => 50 |
| 233 | 233 |
def spent_hours |
| 234 |
@spent_hours ||= time_entries.sum(:hours) || 0
|
|
| 234 |
@spent_hours ||= (time_entries.sum(:hours)*100).round.to_f / 100 || 0
|
|
| 235 | 235 |
end |
| 236 | ||
| 237 |
def spent_hours_colored(value) |
|
| 238 |
if(value > estimated_hours) |
|
| 239 |
return "<FONT COLOR='RED'>"+value.to_s+"</FONT>" |
|
| 240 |
else return value |
|
| 241 |
end |
|
| 242 |
end |
|
| 236 | 243 |
|
| 237 | 244 |
def relations |
| 238 | 245 |
(relations_from + relations_to).sort |
| app/models/query.rb (working copy) | ||
|---|---|---|
| 111 | 111 |
QueryColumn.new(:fixed_version, :sortable => ["#{Version.table_name}.effective_date", "#{Version.table_name}.name"], :default_order => 'desc', :groupable => true),
|
| 112 | 112 |
QueryColumn.new(:start_date, :sortable => "#{Issue.table_name}.start_date"),
|
| 113 | 113 |
QueryColumn.new(:due_date, :sortable => "#{Issue.table_name}.due_date"),
|
| 114 |
QueryColumn.new(:estimated_hours, :sortable => "#{Issue.table_name}.estimated_hours"),
|
|
| 114 |
QueryColumn.new(:estimated_hours, :sortable => "#{Issue.table_name}.estimated_hours" ),
|
|
| 115 |
QueryColumn.new(:spent_hours, :sortable => "SUM(time_entries.hours)" ), |
|
| 115 | 116 |
QueryColumn.new(:done_ratio, :sortable => "#{Issue.table_name}.done_ratio", :groupable => true),
|
| 116 | 117 |
QueryColumn.new(:created_on, :sortable => "#{Issue.table_name}.created_on", :default_order => 'desc'),
|
| 117 | 118 |
] |
| app/controllers/issues_controller.rb (working copy) | ||
|---|---|---|
| 62 | 62 |
:include => [ :assigned_to, :status, :tracker, :project, :priority, :category, :fixed_version ], |
| 63 | 63 |
:conditions => @query.statement, |
| 64 | 64 |
:limit => limit, |
| 65 |
:offset => @issue_pages.current.offset |
|
| 65 |
:offset => @issue_pages.current.offset, |
|
| 66 |
:joins => 'LEFT OUTER JOIN time_entries ON issues.id = time_entries.issue_id', |
|
| 67 |
:group => 'issues.id' |
|
| 66 | 68 |
respond_to do |format| |
| 67 | 69 |
format.html {
|
| 68 | 70 |
if @query.grouped? |
| config/locales/en.yml (working copy) | ||
|---|---|---|
| 170 | 170 |
field_author: Author |
| 171 | 171 |
field_created_on: Created |
| 172 | 172 |
field_updated_on: Updated |
| 173 |
field_spent_hours: Time Spent |
|
| 173 | 174 |
field_field_format: Format |
| 174 | 175 |
field_is_for_all: For all projects |
| 175 | 176 |
field_possible_values: Possible values |