Class: TaskJuggler::ResourceListRE

Inherits:
TableReport show all
Defined in:
lib/taskjuggler/reports/ResourceListRE.rb

Overview

This specialization of TableReport implements a resource listing. It generates a list of resources that can optionally have the assigned tasks nested underneath each resource line.

Instance Attribute Summary

Attributes inherited from TableReport

#legend

Instance Method Summary collapse

Methods inherited from TableReport

alignment, calculated?, defaultColumnTitle, indent, scenarioSpecific?, #to_csv, #to_html

Methods inherited from ReportBase

#a, #filterAccountList, #filterResourceList, #filterTaskList

Constructor Details

#initialize(report) ⇒ ResourceListRE

Create a new object and set some default values.



27
28
29
30
31
32
# File 'lib/taskjuggler/reports/ResourceListRE.rb', line 27

def initialize(report)
  super
  @table = ReportTable.new
  @table.selfcontained = report.get('selfcontained')
  @table.auxDir = report.get('auxdir')
end

Instance Method Details

#generateIntermediateFormatObject

Generate the table in the intermediate format.



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/taskjuggler/reports/ResourceListRE.rb', line 35

def generateIntermediateFormat
  super

  # Prepare the resource list.
  resourceList = PropertyList.new(@project.resources)
  resourceList.setSorting(@report.get('sortResources'))
  resourceList.query = @report.project.reportContexts.last.query
  resourceList = filterResourceList(resourceList, nil,
                                    @report.get('hideResource'),
                                    @report.get('rollupResource'),
                                    @report.get('openNodes'))
  resourceList.sort!

  # Prepare the task list. Don't filter it yet! It would break the
  # *_() LogicalFunctions.
  taskList = PropertyList.new(@project.tasks)
  taskList.setSorting(@report.get('sortTasks'))
  taskList.query = @report.project.reportContexts.last.query
  taskList.sort!

  assignedTaskList = []
  resourceList.each do |resource|
    assignedTaskList += filterTaskList(taskList, resource,
                                       @report.get('hideTask'),
                                       @report.get('rollupTask'),
                                       @report.get('openNodes'))
    assignedTaskList.uniq!
  end


  # Generate the table header.
  @report.get('columns').each do |columnDescr|
    adjustColumnPeriod(columnDescr, assignedTaskList,
                       @report.get('scenarios'))
    generateHeaderCell(columnDescr)
  end

  # Generate the list.
  generateResourceList(resourceList, taskList, nil)
end