doc/TaskJuggler/TimeSheetSummary.html in taskjuggler-0.0.8 vs doc/TaskJuggler/TimeSheetSummary.html in taskjuggler-0.0.9

- old
+ new

@@ -131,10 +131,12 @@ <li><a href="../TaskJuggler/AttributeBase.html">TaskJuggler::AttributeBase</a></li> <li><a href="../TaskJuggler/AttributeDefinition.html">TaskJuggler::AttributeDefinition</a></li> + <li><a href="../TaskJuggler/AttributeOverwrite.html">TaskJuggler::AttributeOverwrite</a></li> + <li><a href="../TaskJuggler/BatchProcessor.html">TaskJuggler::BatchProcessor</a></li> <li><a href="../TaskJuggler/Booking.html">TaskJuggler::Booking</a></li> <li><a href="../TaskJuggler/BookingListAttribute.html">TaskJuggler::BookingListAttribute</a></li> @@ -209,10 +211,12 @@ <li><a href="../TaskJuggler/HTMLGraphics.html">TaskJuggler::HTMLGraphics</a></li> <li><a href="../TaskJuggler/Interval.html">TaskJuggler::Interval</a></li> + <li><a href="../TaskJuggler/IntervalList.html">TaskJuggler::IntervalList</a></li> + <li><a href="../TaskJuggler/IntervalListAttribute.html">TaskJuggler::IntervalListAttribute</a></li> <li><a href="../TaskJuggler/JobInfo.html">TaskJuggler::JobInfo</a></li> <li><a href="../TaskJuggler/Journal.html">TaskJuggler::Journal</a></li> @@ -241,10 +245,12 @@ <li><a href="../TaskJuggler/LogicalExpression.html">TaskJuggler::LogicalExpression</a></li> <li><a href="../TaskJuggler/LogicalExpressionAttribute.html">TaskJuggler::LogicalExpressionAttribute</a></li> + <li><a href="../TaskJuggler/LogicalExpressionListAttribute.html">TaskJuggler::LogicalExpressionListAttribute</a></li> + <li><a href="../TaskJuggler/LogicalFlag.html">TaskJuggler::LogicalFlag</a></li> <li><a href="../TaskJuggler/LogicalFunction.html">TaskJuggler::LogicalFunction</a></li> <li><a href="../TaskJuggler/LogicalOperation.html">TaskJuggler::LogicalOperation</a></li> @@ -521,10 +527,12 @@ <li><a href="../TaskJuggler/VimSyntax.html">TaskJuggler::VimSyntax</a></li> <li><a href="../TaskJuggler/WebServer.html">TaskJuggler::WebServer</a></li> + <li><a href="../TaskJuggler/WelcomePage.html">TaskJuggler::WelcomePage</a></li> + <li><a href="../TaskJuggler/WorkingHours.html">TaskJuggler::WorkingHours</a></li> <li><a href="../TaskJuggler/WorkingHoursAttribute.html">TaskJuggler::WorkingHoursAttribute</a></li> <li><a href="../TaskJuggler/XMLBlob.html">TaskJuggler::XMLBlob</a></li> @@ -547,12 +555,10 @@ <li><a href="../RuntimeConfig.html">RuntimeConfig</a></li> <li><a href="../String.html">String</a></li> - <li><a href="../StringIO.html">StringIO</a></li> - </ul> <div id="no-class-search-results" style="display: none;">No matching classes.</div> </div> @@ -660,37 +666,37 @@ <div class="method-source-code" id="new-source"> <pre> - <span class="ruby-comment cmt"># File lib/TimeSheetSummary.rb, line 26</span> -26: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> -27: <span class="ruby-keyword kw">super</span>(<span class="ruby-value str">'tj3ts_summary'</span>, <span class="ruby-value str">'summary'</span>) -28: -29: <span class="ruby-comment cmt"># This is a LogicalExpression string that controls what resources should</span> -30: <span class="ruby-comment cmt"># not be considered in the summary.</span> -31: <span class="ruby-ivar">@hideResource</span> = <span class="ruby-value str">'0'</span> -32: <span class="ruby-comment cmt"># The base directory of the time sheet templates.</span> -33: <span class="ruby-ivar">@templateDir</span> = <span class="ruby-value str">'TimeSheetTemplates'</span> -34: <span class="ruby-comment cmt"># The base directory of the submitted time sheets</span> -35: <span class="ruby-ivar">@sheetDir</span> = <span class="ruby-value str">'TimeSheets'</span> -36: <span class="ruby-comment cmt"># The log file</span> -37: <span class="ruby-ivar">@logFile</span> = <span class="ruby-value str">'timesheets.log'</span> -38: <span class="ruby-comment cmt"># A list of email addresses to send the individual sheets. The sender</span> -39: <span class="ruby-comment cmt"># will be the sheet submitter.</span> -40: <span class="ruby-ivar">@sheetRecipients</span> = [] -41: <span class="ruby-comment cmt"># A list of email addresses to send the summary to</span> -42: <span class="ruby-ivar">@digestRecipients</span> = [] -43: -44: <span class="ruby-ivar">@resourceIntro</span> = <span class="ruby-value str">&quot;== Weekly Report from &lt;nowiki&gt;%s&lt;/nowiki&gt; ==\n&quot;</span> -45: <span class="ruby-ivar">@resourceSheetSubject</span> = <span class="ruby-value str">&quot;Weekly report %s&quot;</span> -46: <span class="ruby-ivar">@summarySubject</span> = <span class="ruby-value str">&quot;Weekly staff reports %s&quot;</span> -47: <span class="ruby-ivar">@reminderSubject</span> = <span class="ruby-value str">&quot;Your time sheet for the period ending %s is overdue!&quot;</span> -48: <span class="ruby-ivar">@reminderText</span> = <span class="ruby-value str">The deadline for your time sheet submission has passed but we haven't receivedit yet. Please submit your time sheet immediately so the content can still beincluded in the management reports. Please send a copy of your submissionnotification email to your manager. If possible, your manager will still tryto include your report data in his/her report.Please be aware that post deadline submissions must be processed manually andcreate an additional load for your manager and/or project manager. Please tryto submit in time in the future.Thanks for your cooperation!</span> -49: <span class="ruby-ivar">@defaulterHeader</span> = <span class="ruby-value str">&quot;The following %d person(s) have not yet submitted &quot;</span> <span class="ruby-operator">+</span> -50: <span class="ruby-value str">&quot;their time sheets:\n\n&quot;</span> -51: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TimeSheetSummary.rb, line 27</span> +27: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span> +28: <span class="ruby-keyword kw">super</span>(<span class="ruby-value str">'tj3ts_summary'</span>, <span class="ruby-value str">'summary'</span>) +29: +30: <span class="ruby-comment cmt"># This is a LogicalExpression string that controls what resources should</span> +31: <span class="ruby-comment cmt"># not be considered in the summary.</span> +32: <span class="ruby-ivar">@hideResource</span> = <span class="ruby-value str">'0'</span> +33: <span class="ruby-comment cmt"># The base directory of the time sheet templates.</span> +34: <span class="ruby-ivar">@templateDir</span> = <span class="ruby-value str">'TimeSheetTemplates'</span> +35: <span class="ruby-comment cmt"># The base directory of the submitted time sheets</span> +36: <span class="ruby-ivar">@sheetDir</span> = <span class="ruby-value str">'TimeSheets'</span> +37: <span class="ruby-comment cmt"># The log file</span> +38: <span class="ruby-ivar">@logFile</span> = <span class="ruby-value str">'timesheets.log'</span> +39: <span class="ruby-comment cmt"># A list of email addresses to send the individual sheets. The sender</span> +40: <span class="ruby-comment cmt"># will be the sheet submitter.</span> +41: <span class="ruby-ivar">@sheetRecipients</span> = [] +42: <span class="ruby-comment cmt"># A list of email addresses to send the summary to</span> +43: <span class="ruby-ivar">@digestRecipients</span> = [] +44: +45: <span class="ruby-ivar">@resourceIntro</span> = <span class="ruby-value str">&quot;== Weekly Report from &lt;nowiki&gt;%s&lt;/nowiki&gt; ==\n&quot;</span> +46: <span class="ruby-ivar">@resourceSheetSubject</span> = <span class="ruby-value str">&quot;Weekly report %s&quot;</span> +47: <span class="ruby-ivar">@summarySubject</span> = <span class="ruby-value str">&quot;Weekly staff reports %s&quot;</span> +48: <span class="ruby-ivar">@reminderSubject</span> = <span class="ruby-value str">&quot;Your time sheet for the period ending %s is overdue!&quot;</span> +49: <span class="ruby-ivar">@reminderText</span> = <span class="ruby-value str">The deadline for your time sheet submission has passed but we haven't receivedit yet. Please submit your time sheet immediately so the content can still beincluded in the management reports. Please send a copy of your submissionnotification email to your manager. If possible, your manager will still tryto include your report data in his/her report.Please be aware that post deadline submissions must be processed manually andcreate an additional load for your manager and/or project manager. Please tryto submit in time in the future.Thanks for your cooperation!</span> +50: <span class="ruby-ivar">@defaulterHeader</span> = <span class="ruby-value str">&quot;The following %d person(s) have not yet submitted &quot;</span> <span class="ruby-operator">+</span> +51: <span class="ruby-value str">&quot;their time sheets:\n\n&quot;</span> +52: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -723,83 +729,83 @@ <div class="method-source-code" id="send-ummary-source"> <pre> - <span class="ruby-comment cmt"># File lib/TimeSheetSummary.rb, line 66</span> - 66: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sendSummary</span>(<span class="ruby-identifier">resourceIds</span>) - 67: <span class="ruby-identifier">setWorkingDir</span> - 68: - 69: <span class="ruby-identifier">summary</span> = <span class="ruby-value str">''</span> - 70: <span class="ruby-identifier">defaulterList</span> = [] - 71: <span class="ruby-identifier">getResourceList</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">resource</span><span class="ruby-operator">|</span> - 72: <span class="ruby-identifier">resourceId</span> = <span class="ruby-identifier">resource</span>[<span class="ruby-value">0</span>] - 73: <span class="ruby-identifier">resourceName</span> = <span class="ruby-identifier">resource</span>[<span class="ruby-value">1</span>] - 74: <span class="ruby-identifier">resourceEmail</span> = <span class="ruby-identifier">resource</span>[<span class="ruby-value">2</span>] - 75: <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">resourceIds</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">resourceIds</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">resourceId</span>) - 76: - 77: <span class="ruby-identifier">templateFile</span> = <span class="ruby-node">&quot;#{@templateDir}/#{@date}/#{resourceId}_#{@date}.tji&quot;</span> - 78: <span class="ruby-identifier">sheetFile</span> = <span class="ruby-node">&quot;#{@sheetDir}/#{@date}/#{resourceId}_#{@date}.tji&quot;</span> - 79: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">templateFile</span>) - 80: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">sheetFile</span>) - 81: <span class="ruby-comment cmt"># If there are no recipients specified, we don't need to compile</span> - 82: <span class="ruby-comment cmt"># the summary.</span> - 83: <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@digestRecipients</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@sheetRecipients</span>.<span class="ruby-identifier">empty?</span> - 84: <span class="ruby-comment cmt"># Resource has submitted a time sheet</span> - 85: <span class="ruby-identifier">sheet</span> = <span class="ruby-identifier">getResourceJournal</span>(<span class="ruby-identifier">sheetFile</span>) - 86: <span class="ruby-identifier">summary</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">sprintf</span>(<span class="ruby-ivar">@resourceIntro</span>, <span class="ruby-identifier">resourceName</span>) - 87: <span class="ruby-identifier">summary</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">sheet</span> <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;\n----\n&quot;</span> - 88: <span class="ruby-identifier">info</span>(<span class="ruby-node">&quot;Adding report from #{resourceName} to summary&quot;</span>) - 89: - 90: <span class="ruby-ivar">@sheetRecipients</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">to</span><span class="ruby-operator">|</span> - 91: <span class="ruby-identifier">sendRichTextEmail</span>(<span class="ruby-identifier">to</span>, <span class="ruby-identifier">sprintf</span>(<span class="ruby-ivar">@resourceSheetSubject</span>, <span class="ruby-ivar">@date</span>), - 92: <span class="ruby-identifier">sheet</span>, <span class="ruby-keyword kw">nil</span>, - 93: <span class="ruby-node">&quot;#{resourceName} &lt;#{resourceEmail}&gt;&quot;</span>) - 94: <span class="ruby-keyword kw">end</span> - 95: <span class="ruby-keyword kw">end</span> - 96: <span class="ruby-keyword kw">else</span> - 97: <span class="ruby-identifier">defaulterList</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">resource</span> - 98: <span class="ruby-comment cmt"># Resource did not submit a time sheet</span> - 99: <span class="ruby-identifier">info</span>(<span class="ruby-node">&quot;Report from #{resourceId} is missing&quot;</span>) -100: <span class="ruby-keyword kw">end</span> -101: <span class="ruby-keyword kw">end</span> -102: <span class="ruby-keyword kw">end</span> -103: -104: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">defaulterList</span>.<span class="ruby-identifier">empty?</span> -105: <span class="ruby-comment cmt"># Prepend the defaulter list to the summary.</span> -106: <span class="ruby-identifier">text</span> = <span class="ruby-identifier">sprintf</span>(<span class="ruby-ivar">@defaulterHeader</span>, <span class="ruby-identifier">defaulterList</span>.<span class="ruby-identifier">length</span>) -107: <span class="ruby-identifier">defaulterList</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">resource</span><span class="ruby-operator">|</span> -108: <span class="ruby-identifier">text</span> <span class="ruby-operator">+=</span> <span class="ruby-node">&quot;* &lt;nowiki&gt;#{resource[1]}&lt;/nowiki&gt;\n&quot;</span> -109: <span class="ruby-keyword kw">end</span> -110: <span class="ruby-identifier">text</span> <span class="ruby-operator">+=</span> <span class="ruby-value str">&quot;\n----\n&quot;</span> -111: <span class="ruby-identifier">summary</span> = <span class="ruby-identifier">text</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">summary</span> -112: -113: <span class="ruby-comment cmt"># Create a file with the IDs of the resources who's reports are</span> -114: <span class="ruby-comment cmt"># missing.</span> -115: <span class="ruby-identifier">missingFile</span> = <span class="ruby-node">&quot;#{@sheetDir}/#{@date}/missing-reports&quot;</span> -116: <span class="ruby-keyword kw">begin</span> -117: <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">missingFile</span>, <span class="ruby-value str">'w'</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> -118: <span class="ruby-identifier">defaulterList</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">resource</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">resource</span>[<span class="ruby-value">0</span>] } -119: <span class="ruby-keyword kw">end</span> -120: <span class="ruby-keyword kw">rescue</span> -121: <span class="ruby-identifier">error</span>(<span class="ruby-node">&quot;Cannot write file with missing reports (#missingFile): #{$!}&quot;</span>) -122: <span class="ruby-keyword kw">end</span> -123: <span class="ruby-keyword kw">end</span> -124: -125: <span class="ruby-comment cmt"># Send out the summary text to the list of digest recipients.</span> -126: <span class="ruby-ivar">@digestRecipients</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">to</span><span class="ruby-operator">|</span> -127: <span class="ruby-identifier">sendRichTextEmail</span>(<span class="ruby-identifier">to</span>, <span class="ruby-identifier">sprintf</span>(<span class="ruby-ivar">@summarySubject</span>, <span class="ruby-ivar">@date</span>), <span class="ruby-identifier">summary</span>) -128: <span class="ruby-keyword kw">end</span> -129: -130: <span class="ruby-comment cmt"># If there is a reminder text defined, resend the template to those</span> -131: <span class="ruby-comment cmt"># individuals that have not yet submitted their report yet.</span> -132: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@reminderText</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@reminderText</span>.<span class="ruby-identifier">empty?</span> -133: <span class="ruby-identifier">defaulterList</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">resource</span><span class="ruby-operator">|</span> -134: <span class="ruby-identifier">sendReminder</span>(<span class="ruby-identifier">resource</span>[<span class="ruby-value">0</span>], <span class="ruby-identifier">resource</span>[<span class="ruby-value">1</span>], <span class="ruby-identifier">resource</span>[<span class="ruby-value">2</span>]) -135: <span class="ruby-keyword kw">end</span> -136: <span class="ruby-keyword kw">end</span> -137: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TimeSheetSummary.rb, line 67</span> + 67: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sendSummary</span>(<span class="ruby-identifier">resourceIds</span>) + 68: <span class="ruby-identifier">setWorkingDir</span> + 69: + 70: <span class="ruby-identifier">summary</span> = <span class="ruby-value str">''</span> + 71: <span class="ruby-identifier">defaulterList</span> = [] + 72: <span class="ruby-identifier">getResourceList</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">resource</span><span class="ruby-operator">|</span> + 73: <span class="ruby-identifier">resourceId</span> = <span class="ruby-identifier">resource</span>[<span class="ruby-value">0</span>] + 74: <span class="ruby-identifier">resourceName</span> = <span class="ruby-identifier">resource</span>[<span class="ruby-value">1</span>] + 75: <span class="ruby-identifier">resourceEmail</span> = <span class="ruby-identifier">resource</span>[<span class="ruby-value">2</span>] + 76: <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">resourceIds</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-identifier">resourceIds</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">resourceId</span>) + 77: + 78: <span class="ruby-identifier">templateFile</span> = <span class="ruby-node">&quot;#{@templateDir}/#{@date}/#{resourceId}_#{@date}.tji&quot;</span> + 79: <span class="ruby-identifier">sheetFile</span> = <span class="ruby-node">&quot;#{@sheetDir}/#{@date}/#{resourceId}_#{@date}.tji&quot;</span> + 80: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">templateFile</span>) + 81: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">sheetFile</span>) + 82: <span class="ruby-comment cmt"># If there are no recipients specified, we don't need to compile</span> + 83: <span class="ruby-comment cmt"># the summary.</span> + 84: <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@digestRecipients</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@sheetRecipients</span>.<span class="ruby-identifier">empty?</span> + 85: <span class="ruby-comment cmt"># Resource has submitted a time sheet</span> + 86: <span class="ruby-identifier">sheet</span> = <span class="ruby-identifier">getResourceJournal</span>(<span class="ruby-identifier">sheetFile</span>) + 87: <span class="ruby-identifier">summary</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">sprintf</span>(<span class="ruby-ivar">@resourceIntro</span>, <span class="ruby-identifier">resourceName</span>) + 88: <span class="ruby-identifier">summary</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">sheet</span> <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;\n----\n&quot;</span> + 89: <span class="ruby-identifier">info</span>(<span class="ruby-node">&quot;Adding report from #{resourceName} to summary&quot;</span>) + 90: + 91: <span class="ruby-ivar">@sheetRecipients</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">to</span><span class="ruby-operator">|</span> + 92: <span class="ruby-identifier">sendRichTextEmail</span>(<span class="ruby-identifier">to</span>, <span class="ruby-identifier">sprintf</span>(<span class="ruby-ivar">@resourceSheetSubject</span>, <span class="ruby-ivar">@date</span>), + 93: <span class="ruby-identifier">sheet</span>, <span class="ruby-keyword kw">nil</span>, + 94: <span class="ruby-node">&quot;#{resourceName} &lt;#{resourceEmail}&gt;&quot;</span>) + 95: <span class="ruby-keyword kw">end</span> + 96: <span class="ruby-keyword kw">end</span> + 97: <span class="ruby-keyword kw">else</span> + 98: <span class="ruby-identifier">defaulterList</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">resource</span> + 99: <span class="ruby-comment cmt"># Resource did not submit a time sheet</span> +100: <span class="ruby-identifier">info</span>(<span class="ruby-node">&quot;Report from #{resourceId} is missing&quot;</span>) +101: <span class="ruby-keyword kw">end</span> +102: <span class="ruby-keyword kw">end</span> +103: <span class="ruby-keyword kw">end</span> +104: +105: <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">defaulterList</span>.<span class="ruby-identifier">empty?</span> +106: <span class="ruby-comment cmt"># Prepend the defaulter list to the summary.</span> +107: <span class="ruby-identifier">text</span> = <span class="ruby-identifier">sprintf</span>(<span class="ruby-ivar">@defaulterHeader</span>, <span class="ruby-identifier">defaulterList</span>.<span class="ruby-identifier">length</span>) +108: <span class="ruby-identifier">defaulterList</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">resource</span><span class="ruby-operator">|</span> +109: <span class="ruby-identifier">text</span> <span class="ruby-operator">+=</span> <span class="ruby-node">&quot;* &lt;nowiki&gt;#{resource[1]}&lt;/nowiki&gt;\n&quot;</span> +110: <span class="ruby-keyword kw">end</span> +111: <span class="ruby-identifier">text</span> <span class="ruby-operator">+=</span> <span class="ruby-value str">&quot;\n----\n&quot;</span> +112: <span class="ruby-identifier">summary</span> = <span class="ruby-identifier">text</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">summary</span> +113: +114: <span class="ruby-comment cmt"># Create a file with the IDs of the resources who's reports are</span> +115: <span class="ruby-comment cmt"># missing.</span> +116: <span class="ruby-identifier">missingFile</span> = <span class="ruby-node">&quot;#{@sheetDir}/#{@date}/missing-reports&quot;</span> +117: <span class="ruby-keyword kw">begin</span> +118: <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">missingFile</span>, <span class="ruby-value str">'w'</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> +119: <span class="ruby-identifier">defaulterList</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">resource</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">resource</span>[<span class="ruby-value">0</span>] } +120: <span class="ruby-keyword kw">end</span> +121: <span class="ruby-keyword kw">rescue</span> +122: <span class="ruby-identifier">error</span>(<span class="ruby-node">&quot;Cannot write file with missing reports (#missingFile): #{$!}&quot;</span>) +123: <span class="ruby-keyword kw">end</span> +124: <span class="ruby-keyword kw">end</span> +125: +126: <span class="ruby-comment cmt"># Send out the summary text to the list of digest recipients.</span> +127: <span class="ruby-ivar">@digestRecipients</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">to</span><span class="ruby-operator">|</span> +128: <span class="ruby-identifier">sendRichTextEmail</span>(<span class="ruby-identifier">to</span>, <span class="ruby-identifier">sprintf</span>(<span class="ruby-ivar">@summarySubject</span>, <span class="ruby-ivar">@date</span>), <span class="ruby-identifier">summary</span>) +129: <span class="ruby-keyword kw">end</span> +130: +131: <span class="ruby-comment cmt"># If there is a reminder text defined, resend the template to those</span> +132: <span class="ruby-comment cmt"># individuals that have not yet submitted their report yet.</span> +133: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@reminderText</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@reminderText</span>.<span class="ruby-identifier">empty?</span> +134: <span class="ruby-identifier">defaulterList</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">resource</span><span class="ruby-operator">|</span> +135: <span class="ruby-identifier">sendReminder</span>(<span class="ruby-identifier">resource</span>[<span class="ruby-value">0</span>], <span class="ruby-identifier">resource</span>[<span class="ruby-value">1</span>], <span class="ruby-identifier">resource</span>[<span class="ruby-value">2</span>]) +136: <span class="ruby-keyword kw">end</span> +137: <span class="ruby-keyword kw">end</span> +138: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -832,30 +838,30 @@ <div class="method-source-code" id="get-esource-ournal-source"> <pre> - <span class="ruby-comment cmt"># File lib/TimeSheetSummary.rb, line 153</span> -153: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">getResourceJournal</span>(<span class="ruby-identifier">sheetFile</span>) -154: <span class="ruby-identifier">err</span> = <span class="ruby-value str">''</span> -155: <span class="ruby-identifier">status</span> = <span class="ruby-keyword kw">nil</span> -156: <span class="ruby-identifier">report</span> = <span class="ruby-keyword kw">nil</span> -157: <span class="ruby-identifier">warnings</span> = <span class="ruby-keyword kw">nil</span> -158: <span class="ruby-keyword kw">begin</span> -159: <span class="ruby-comment cmt"># Save a copy of the sheet for debugging purposes.</span> -160: <span class="ruby-identifier">command</span> = <span class="ruby-node">&quot;tj3client --silent check-ts #{@projectId} #{sheetFile}&quot;</span> -161: <span class="ruby-identifier">status</span> = <span class="ruby-constant">Open4</span>.<span class="ruby-identifier">popen4</span>(<span class="ruby-identifier">command</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">pid</span>, <span class="ruby-identifier">stdin</span>, <span class="ruby-identifier">stdout</span>, <span class="ruby-identifier">stderr</span><span class="ruby-operator">|</span> -162: <span class="ruby-comment cmt"># Send the report to the tj3client process via stdin.</span> -163: <span class="ruby-identifier">report</span> = <span class="ruby-identifier">stdout</span>.<span class="ruby-identifier">read</span> -164: <span class="ruby-identifier">warnings</span> = <span class="ruby-identifier">stderr</span>.<span class="ruby-identifier">read</span> -165: <span class="ruby-keyword kw">end</span> -166: <span class="ruby-keyword kw">rescue</span> -167: <span class="ruby-identifier">fatal</span>(<span class="ruby-node">&quot;Cannot summarize sheet: #{$!}&quot;</span>) -168: <span class="ruby-keyword kw">end</span> -169: -170: <span class="ruby-identifier">report</span> -171: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TimeSheetSummary.rb, line 154</span> +154: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">getResourceJournal</span>(<span class="ruby-identifier">sheetFile</span>) +155: <span class="ruby-identifier">err</span> = <span class="ruby-value str">''</span> +156: <span class="ruby-identifier">status</span> = <span class="ruby-keyword kw">nil</span> +157: <span class="ruby-identifier">report</span> = <span class="ruby-keyword kw">nil</span> +158: <span class="ruby-identifier">warnings</span> = <span class="ruby-keyword kw">nil</span> +159: <span class="ruby-keyword kw">begin</span> +160: <span class="ruby-comment cmt"># Save a copy of the sheet for debugging purposes.</span> +161: <span class="ruby-identifier">command</span> = <span class="ruby-node">&quot;tj3client --silent check-ts #{@projectId} #{sheetFile}&quot;</span> +162: <span class="ruby-identifier">status</span> = <span class="ruby-constant">Open4</span>.<span class="ruby-identifier">popen4</span>(<span class="ruby-identifier">command</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">pid</span>, <span class="ruby-identifier">stdin</span>, <span class="ruby-identifier">stdout</span>, <span class="ruby-identifier">stderr</span><span class="ruby-operator">|</span> +163: <span class="ruby-comment cmt"># Send the report to the tj3client process via stdin.</span> +164: <span class="ruby-identifier">report</span> = <span class="ruby-identifier">stdout</span>.<span class="ruby-identifier">read</span> +165: <span class="ruby-identifier">warnings</span> = <span class="ruby-identifier">stderr</span>.<span class="ruby-identifier">read</span> +166: <span class="ruby-keyword kw">end</span> +167: <span class="ruby-keyword kw">rescue</span> +168: <span class="ruby-identifier">fatal</span>(<span class="ruby-node">&quot;Cannot summarize sheet: #{$!}&quot;</span>) +169: <span class="ruby-keyword kw">end</span> +170: +171: <span class="ruby-identifier">report</span> +172: <span class="ruby-keyword kw">end</span></pre> </div> </div> @@ -882,21 +888,21 @@ <div class="method-source-code" id="send-eminder-source"> <pre> - <span class="ruby-comment cmt"># File lib/TimeSheetSummary.rb, line 141</span> -141: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sendReminder</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">name</span>, <span class="ruby-identifier">email</span>) -142: <span class="ruby-identifier">attachment</span> = <span class="ruby-node">&quot;#{@templateDir}/#{@date}/#{id}_#{@date}.tji&quot;</span> -143: <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">attachment</span>) -144: <span class="ruby-identifier">error</span>(<span class="ruby-value str">&quot;sendReportTemplates: &quot;</span> <span class="ruby-operator">+</span> -145: <span class="ruby-node">&quot;#{@sheetType} sheet #{attachment} for #{name} not found&quot;</span>) -146: <span class="ruby-keyword kw">end</span> -147: -148: <span class="ruby-identifier">message</span> = <span class="ruby-node">&quot;Hello #{name}!\n\n#{@reminderText}&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">attachment</span>) -149: -150: <span class="ruby-identifier">sendEmail</span>(<span class="ruby-identifier">email</span>, <span class="ruby-identifier">sprintf</span>(<span class="ruby-ivar">@reminderSubject</span>, <span class="ruby-ivar">@date</span>), <span class="ruby-identifier">message</span>, <span class="ruby-identifier">attachment</span>) -151: <span class="ruby-keyword kw">end</span></pre> + <span class="ruby-comment cmt"># File lib/TimeSheetSummary.rb, line 142</span> +142: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sendReminder</span>(<span class="ruby-identifier">id</span>, <span class="ruby-identifier">name</span>, <span class="ruby-identifier">email</span>) +143: <span class="ruby-identifier">attachment</span> = <span class="ruby-node">&quot;#{@templateDir}/#{@date}/#{id}_#{@date}.tji&quot;</span> +144: <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">attachment</span>) +145: <span class="ruby-identifier">error</span>(<span class="ruby-value str">&quot;sendReportTemplates: &quot;</span> <span class="ruby-operator">+</span> +146: <span class="ruby-node">&quot;#{@sheetType} sheet #{attachment} for #{name} not found&quot;</span>) +147: <span class="ruby-keyword kw">end</span> +148: +149: <span class="ruby-identifier">message</span> = <span class="ruby-node">&quot;Hello #{name}!\n\n#{@reminderText}&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">attachment</span>) +150: +151: <span class="ruby-identifier">sendEmail</span>(<span class="ruby-identifier">email</span>, <span class="ruby-identifier">sprintf</span>(<span class="ruby-ivar">@reminderSubject</span>, <span class="ruby-ivar">@date</span>), <span class="ruby-identifier">message</span>, <span class="ruby-identifier">attachment</span>) +152: <span class="ruby-keyword kw">end</span></pre> </div> </div>