Class Index [+]

Quicksearch

TaskJuggler::StatusSheetSender

The StatusSheetSender class generates status sheet templates for the current week and sends them out to the managers. For this to work, the resources must provide the ‘Email’ custom attribute with their email address. The actual project data is accessed via tj3client on a tj3 server process.

Attributes

date[RW]
hideResource[RW]

Public Class Methods

new(appName) click to toggle source
    # File lib/taskjuggler/StatusSheetSender.rb, line 26
26:     def initialize(appName)
27:       super(appName, 'status')
28: 
29:       # This is a LogicalExpression string that controls what resources should
30:       # not be getting a status sheet.
31:       @hideResource = '0'
32:       # The base directory of the status sheet templates.
33:       @templateDir = 'StatusSheetTemplates'
34:       # The base directory of the received time sheets.
35:       @timeSheetDir = 'TimeSheets'
36:       # This file contains the time intervals that the StatusSheetReceiver will
37:       # accept as a valid interval.
38:       @signatureFile = "#{@templateDir}/acceptable_intervals"
39:       # The log file
40:       @logFile = 'statussheets.log'
41: 
42:       @signatureFilter = /^[ ]*statussheet\s[a-z][a-z0-9_]*\s([0-9:\-+]*\s-\s[0-9:\-+]*)/
43:       @introText = Please find enclosed your weekly status report template. Please fill out theform and send it back to the sender of this email. You can either use theattached file or the body of the email. In case you send it in the body of theemail, make sure it only contains the 'statussheet' syntax. It must be plaintext, UTF-8 encoded and the status sheet header from 'statussheet' to the periodend date must be in a single line that starts at the beginning of the line.
44:       # tj3ts_summary generates a list of resources that have not submitted
45:       # their reports yet. If you want to generate the warning below, make
46:       # sure you run tj3ts_summary immediately before you sent the status sheet
47:       # templates.
48:       defaulters = defaulterList
49:       unless defaulters.empty?
50:         @introText += =============================== W A R N I N G ==============================The following people have not submitted their report yet. The status reportsfor the work they have done is not included in this template! You can eithermanually add their status to the tasks or asked them to send their time sheetimmediately and re-request this template.#{defaulters.join}
51:       end
52: 
53:       @mailSubject = "Your weekly status report template for %s"
54:     end

Public Instance Methods

defaulterList() click to toggle source
     # File lib/taskjuggler/StatusSheetSender.rb, line 74
 74:     def defaulterList
 75:       dirs = Dir.glob("#{@timeSheetDir}/????-??-??").sort
 76:       tsDir = nil
 77:       # The status sheet intervals and the time sheet intervals are not
 78:       # identical. The status sheet interval can be smaller and is somewhat
 79:       # later. But it always includes the end date of the corresponding time
 80:       # sheet period. To get the file with the IDs of the resources that have
 81:       # not submitted their report, we need to find the time sheet directory
 82:       # that is within the status sheet period.
 83:       repDate = Time.local(*@date.split('-'))
 84:       dirs.each do |dir|
 85:         dirDate = Time.local(*dir[10..1].split('-'))
 86:         if dirDate < repDate
 87:           tsDir = dir
 88:         else
 89:           break
 90:         end
 91:       end
 92:       # Check if there is a time sheet directory.
 93:       return [] unless tsDir
 94: 
 95:       missingFile = "#{tsDir}/missing-reports"
 96:       # Check if it's got a missing-reports file.
 97:       return [] if !File.exists?(missingFile)
 98: 
 99:       # The sheet could have been submitted after tj3ts_summary was run. We
100:       # ignore the entry if a time sheet file now exists. There is a race
101:       # condition here. The file may exist, but it may not yet be loaded for
102:       # the current project that is used to generate the status report. There
103:       # is a race condition here. The file may exist, but it may not yet be
104:       # loaded for the current project that is used to generate the status
105:       # report.
106:       list = File.readlines(missingFile)
107:       list.delete_if do |resource|
108:         tsDate = tsDir[10..1]
109:         File.exists?("#{tsDir}/#{resource.chomp}_#{tsDate}.tji")
110:       end
111: 
112:       # Return the content of the file.
113:       list
114:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.