Project

General

Profile

RE: Show subtask ID in column on Issue list ยป query-subtasks.patch

Greg T, 2017-03-16 16:19

View differences:

dev/app/models/issue_query.rb 2017-03-16 15:16:01.845021275 +0100
43 43
    QueryColumn.new(:created_on, :sortable => "#{Issue.table_name}.created_on", :default_order => 'desc'),
44 44
    QueryColumn.new(:closed_on, :sortable => "#{Issue.table_name}.closed_on", :default_order => 'desc'),
45 45
    QueryColumn.new(:relations, :caption => :label_related_issues),
46
    QueryColumn.new(:subtasks, :caption => :label_subtask_plural),
46 47
    QueryColumn.new(:description, :inline => false)
47 48
  ]
48 49

  
dev/app/models/issue.rb 2017-03-16 15:25:20.399259639 +0100
241 241
    @assignable_versions = nil
242 242
    @relations = nil
243 243
    @spent_hours = nil
244
    @subtasks = nil
244 245
    @total_spent_hours = nil
245 246
    @total_estimated_hours = nil
246 247
    base_reload(*args)
......
1006 1007
    @spent_hours ||= time_entries.sum(:hours) || 0
1007 1008
  end
1008 1009

  
1010
  def subtasks
1011
    @subtasks ||= IssueRelation::Relations.new(self, children)
1012
  end
1013

  
1009 1014
  # Returns the total number of hours spent on this issue and its descendants
1010 1015
  def total_spent_hours
1011 1016
    @total_spent_hours ||= if leaf?
    (1-1/1)