Patch #1582 » add_time_spent_column_to_issues-svn_r2823.patch
| app/helpers/issues_helper.rb (working copy) | ||
|---|---|---|
|
l(:field_due_date),
|
||
|
l(:field_done_ratio),
|
||
|
l(:field_estimated_hours),
|
||
|
l(:field_spent_hours),
|
||
|
l(:field_created_on),
|
||
|
l(:field_updated_on)
|
||
|
]
|
||
| ... | ... | |
|
format_date(issue.due_date),
|
||
|
issue.done_ratio,
|
||
|
issue.estimated_hours.to_s.gsub('.', decimal_separator),
|
||
|
issue.spent_hours,
|
||
|
format_time(issue.created_on),
|
||
|
format_time(issue.updated_on)
|
||
|
]
|
||
| app/models/issue.rb (working copy) | ||
|---|---|---|
|
# spent_hours => 0
|
||
|
# spent_hours => 50
|
||
|
def spent_hours
|
||
|
@spent_hours ||= time_entries.sum(:hours) || 0
|
||
|
@spent_hours ||= (time_entries.sum(:hours)*100).round.to_f / 100 || 0
|
||
|
end
|
||
|
|
||
|
def relations
|
||
| app/models/query.rb (working copy) | ||
|---|---|---|
|
QueryColumn.new(:fixed_version, :sortable => ["#{Version.table_name}.effective_date", "#{Version.table_name}.name"], :default_order => 'desc', :groupable => true),
|
||
|
QueryColumn.new(:start_date, :sortable => "#{Issue.table_name}.start_date"),
|
||
|
QueryColumn.new(:due_date, :sortable => "#{Issue.table_name}.due_date"),
|
||
|
QueryColumn.new(:estimated_hours, :sortable => "#{Issue.table_name}.estimated_hours"),
|
||
|
QueryColumn.new(:estimated_hours, :sortable => "#{Issue.table_name}.estimated_hours" ),
|
||
|
QueryColumn.new(:spent_hours, :sortable => "SUM(time_entries.hours)" ),
|
||
|
QueryColumn.new(:done_ratio, :sortable => "#{Issue.table_name}.done_ratio", :groupable => true),
|
||
|
QueryColumn.new(:created_on, :sortable => "#{Issue.table_name}.created_on", :default_order => 'desc'),
|
||
|
]
|
||
| app/controllers/issues_controller.rb (working copy) | ||
|---|---|---|
|
:include => [ :assigned_to, :status, :tracker, :project, :priority, :category, :fixed_version ],
|
||
|
:conditions => @query.statement,
|
||
|
:limit => limit,
|
||
|
:offset => @issue_pages.current.offset
|
||
|
:offset => @issue_pages.current.offset,
|
||
|
:joins => 'LEFT OUTER JOIN time_entries ON issues.id = time_entries.issue_id',
|
||
|
:group => 'issues.id'
|
||
|
respond_to do |format|
|
||
|
format.html {
|
||
|
if @query.grouped?
|
||
| config/locales/en.yml (working copy) | ||
|---|---|---|
|
field_author: Author
|
||
|
field_created_on: Created
|
||
|
field_updated_on: Updated
|
||
|
field_spent_hours: Time Spent
|
||
|
field_field_format: Format
|
||
|
field_is_for_all: For all projects
|
||
|
field_possible_values: Possible values
|
||