Project

General

Profile

Patch #20687 » quota-issues.diff

Timo Uhlmann, 2015-09-07 11:33

View differences:

app/models/issue.rb
395 395
    'due_date',
396 396
    'done_ratio',
397 397
    'estimated_hours',
398
    'is_quota',
398 399
    'custom_field_values',
399 400
    'custom_fields',
400 401
    'lock_version',
db/migrate/20150907080738_add_is_quota_to_issue.rb
1
class AddIsQuotaToIssue < ActiveRecord::Migration
2
  def change
3
    add_column :issues, :is_quota, :boolean
4
  end
5
end
0
- 
app/views/issues/_attributes.html.erb
64 64
<p><%= f.text_field :estimated_hours, :size => 3, :required => @issue.required_attribute?('estimated_hours') %> <%= l(:field_hours) %></p>
65 65
<% end %>
66 66

  
67
<% if @issue.safe_attribute? 'is_quota' %>
68
<p><%= f.check_box :is_quota %></p>
69
<% end %>
70

  
67 71
<% if @issue.safe_attribute?('done_ratio') && Issue.use_field_for_done_ratio? %>
68 72
<p><%= f.select :done_ratio, ((0..10).to_a.collect {|r| ["#{r*10} %", r*10] }), :required => @issue.required_attribute?('done_ratio') %></p>
69 73
<% end %>
config/locales/en.yml
307 307
  field_assignable: Issues can be assigned to this role
308 308
  field_redirect_existing_links: Redirect existing links
309 309
  field_estimated_hours: Estimated time
310
  field_is_quota: Quota issue
310 311
  field_column_names: Columns
311 312
  field_time_entries: Log time
312 313
  field_time_zone: Time zone
313
- 
app/helpers/issues_helper.rb
119 119
        l_hours_short(issue.estimated_hours)
120 120
      else
121 121
        s = issue.estimated_hours.present? ? l_hours_short(issue.estimated_hours) : ""
122
        s << " (#{l(:label_total)}: #{l_hours_short(issue.total_estimated_hours)})"
122
        s << " (#{l(issue.is_quota? ? :label_subtask_plural : :label_total)}: #{l_hours_short(issue.total_estimated_hours)})"
123 123
        s.html_safe
124 124
      end
125 125
    end
app/models/issue.rb
941 941
    if leaf?
942 942
      estimated_hours
943 943
    else
944
      @total_estimated_hours ||= self_and_descendants.sum(:estimated_hours)
944
      targets = is_quota? ? descendants : self_and_descendants
945
      @total_estimated_hours ||= targets.sum(:estimated_hours)
945 946
    end
946 947
  end
947 948

  
......
1194 1195
  end
1195 1196

  
1196 1197
  def done_ratio_derived?
1197
    !leaf? && Setting.parent_issue_done_ratio == 'derived'
1198
    !leaf? || is_quota? && Setting.parent_issue_done_ratio == 'derived'
1198 1199
  end
1199 1200

  
1200 1201
  def <=>(issue)
1201
- 
config/locales/de.yml
307 307
  field_editable: Bearbeitbar
308 308
  field_effective_date: Datum
309 309
  field_estimated_hours: Geschätzter Aufwand
310
  field_is_quota: Soll-Aufwand
310 311
  field_field_format: Format
311 312
  field_filename: Datei
312 313
  field_filesize: Größe
    (1-1/1)