Project

General

Profile

Patch #20687 » quota-issues.diff

Timo Uhlmann, 2015-09-07 11:33

View differences:

app/models/issue.rb
'due_date',
'done_ratio',
'estimated_hours',
'is_quota',
'custom_field_values',
'custom_fields',
'lock_version',
db/migrate/20150907080738_add_is_quota_to_issue.rb
class AddIsQuotaToIssue < ActiveRecord::Migration
def change
add_column :issues, :is_quota, :boolean
end
end
-
app/views/issues/_attributes.html.erb
<p><%= f.text_field :estimated_hours, :size => 3, :required => @issue.required_attribute?('estimated_hours') %> <%= l(:field_hours) %></p>
<% end %>
<% if @issue.safe_attribute? 'is_quota' %>
<p><%= f.check_box :is_quota %></p>
<% end %>
<% if @issue.safe_attribute?('done_ratio') && Issue.use_field_for_done_ratio? %>
<p><%= f.select :done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }), :required => @issue.required_attribute?('done_ratio') %></p>
<% end %>
config/locales/en.yml
field_assignable: Issues can be assigned to this role
field_redirect_existing_links: Redirect existing links
field_estimated_hours: Estimated time
field_is_quota: Quota issue
field_column_names: Columns
field_time_entries: Log time
field_time_zone: Time zone
-
app/helpers/issues_helper.rb
l_hours_short(issue.estimated_hours)
else
s = issue.estimated_hours.present? ? l_hours_short(issue.estimated_hours) : ""
s << " (#{l(:label_total)}: #{l_hours_short(issue.total_estimated_hours)})"
s << " (#{l(issue.is_quota? ? :label_subtask_plural : :label_total)}: #{l_hours_short(issue.total_estimated_hours)})"
s.html_safe
end
end
app/models/issue.rb
if leaf?
estimated_hours
else
@total_estimated_hours ||= self_and_descendants.sum(:estimated_hours)
targets = is_quota? ? descendants : self_and_descendants
@total_estimated_hours ||= targets.sum(:estimated_hours)
end
end
......
end
def done_ratio_derived?
!leaf? && Setting.parent_issue_done_ratio == 'derived'
!leaf? || is_quota? && Setting.parent_issue_done_ratio == 'derived'
end
def <=>(issue)
-
config/locales/de.yml
field_editable: Bearbeitbar
field_effective_date: Datum
field_estimated_hours: Geschätzter Aufwand
field_is_quota: Soll-Aufwand
field_field_format: Format
field_filename: Datei
field_filesize: Größe
    (1-1/1)