2.5 Adding Resources

To keep things simple, we take the former waterfall example from section 2.2. Now we add some new lines for declaring resources and assigning them to tasks.
   1 # -*- coding: iso8859-15 -*-
   2 from faces import *
   3 from faces.lib import report
   4 from faces.lib import gantt
   5 from faces.lib import resource
   6 
   7 class bob(Resource):
   8     internal = 600.0
   9     external = 1000.0
  10     
  11 class jim(Resource):
  12     internal = 800.0
  13     external = 1200.0
  14 
  15 def My_Project():
  16     start = "1.1.2005"
  17     resource = bob | jim
  18     
  19     def Specification():
  20         effort = Multi("1w", worst="1.5w")
  21 	
  22     def Design():
  23         start = up.Specification.end
  24         effort = Multi("1w", worst="1.2w")
  25 	
  26     def Implementation():
  27         start = up.Design.end
  28 		    
  29         def Module1():
  30             effort = Multi("1w", worst="2w")
  31 	    
  32         def Module2():
  33             effort = "1w 2d"
  34 	    
  35     def Installation():
  36         start = max(up.Implementation.Module1.end, 
  37                     up.Implementation.Module2.end)
  38         effort = "2d"
  39 
  40 project = BalancedProject(My_Project)
  41 
  42 class Gantt(gantt.Standard):
  43     data = project
  44     sharex = "gantt"
  45 
  46 class Resources(resource.Standard):
  47     data = project
  48     sharex = "gantt"
  49     
  50 class Costs(report.Standard):
  51     data = project
  52     
  53     def make_report(self, data):
  54         for t in data: 
  55             yield (t.indent_name(), t.to_string["%HH"].effort,\
  56                    t.costs("internal"), t.costs("external"),\
  57                    t.booked_resource)

line 5
A collection of resource charts are in the package faces.lib.resource

lines 7-13
declares two resources jim and bob. The attributes internal and external define the internal and external cost rate per day for jim and bob.

line 17
All sub tasks of My_Project will be either assigned to bob or jim: For each task faces tries to assign the task to bob. If bob is busy, the task will be assigned to jim.

line 40
BalancedProject defines a project that allocates resources.

lines 44, 48
define a shared time axis, for the charts Gantt and Resources inside the gui. With this method it is easy to compare two chart variants.

lines 46, 47
define a resource chart displaying the assigned task for all resources of project.(figure 2.9)

Figure 2.9: Resource Chart
\includegraphics[width=\textwidth,height=.4\textheight]{tutorial/fifth1}

lines 50-57
define a cost report for the internal and external costs of each task.(figure 2.10) The statement t.to_string["%HH"].effort shows the effort in hours only.
Figure 2.10: Cost Report
\includegraphics[width=\textwidth,height=.4\textheight]{tutorial/fifth2}