Source: site.view [edit]
Function name: displayReviewAnalysis
Arguments: data
Description:
Page type: html
Render function:   displayReviewAnalysis
Module: sandbox

Page source:

<html>
  
  <h1>Review Analysis</h1>
  <h3><webl>data.startTime</webl> - <webl>data.endTime</webl></h3>
  
<webl>

  var GetValues = fun(weekly, field)
     var res = [];
     var i = 0;
     every week in weekly do
        if (i < 5) then
           res = res + [weekly[week][field]]
        end
     end;
     return res
  end; 
  
  var display = fun(title, d)
  
    var h = "<hr><h1>" + title + "</h1>";
    h = h + "<h3>" + ToString(d.total) + " submitted versions (" + ToString(d.newCapsules) + " new capsules):</h3> <ul>\n";
    h = h + "<li>" + ToString(d.requested) + " not yet started (" + ToString(Size(d.newRequested)) + " new"  +")</li>\n"; // + ToString(d.newRequested)
    h = h + "<li>" + ToString(d.inProgress) + " in progress (" + ToString(Size(d.newInProgress)) + " new"  +")</li>\n"; // + ToString(d.newInProgress)
    h = h + "<li>" + ToString(d.manager) + " awaiting manager approval (" + ToString(Size(d.newManager)) + " new" +")</li>\n";   // + ToString(d.newManager) 
    h = h + "<li>" + ToString(d.completed) + " completed (" + ToString(Size(d.newCompleted)) + " new" +")</li>\n";  // + ToString(d.newCompleted) 
    h = h + "<ul><li>" + ToString(d.totRejectedVersions) + " rejected versions</li>\n";
    h = h + "<li>" + ToString(d.totApprovedVersions) + " approved versions</li></ul>\n";
    h = h + "<li>" + ToString(d.totApproved) + " approved capsules</li>\n";
    h = h + "</ul>\n";
    h = h + "<h3>Processing times:</h3> <ul>\n";
    h = h + "<li>" + "Average time to waiting to start review: " + ToString(d.averageWaiting) + 
                  "  (Longest: " + ToString(d.longestWaiting) + " -- " + ToString(d.longestWaitingIssue) + ")</li>\n";
    h = h + "<li>" + "Average time in process: " + ToString(d.averageInProgress) + 
                  "  (Longest: " + ToString(d.longestInProgress) + " -- " + ToString(d.longestInProgressIssue) + ")</li>\n";
    h = h + "<li>" + "Average time for manager review: " + ToString(d.averageManager) + 
                  "  (Longest: " + ToString(d.longestManager) + " -- " + ToString(d.longestManagerIssue) + ")</li>\n";
    h = h + "<li>" + "Average time to complete review: " + ToString(d.averageCompleted) + 
                  "  (Longest: " + ToString(d.longestCompleted) + " -- " + ToString(d.longestCompletedIssue) + ")</li>\n";
    h = h + "<ul><li>" + "Average time for rejections: " + ToString(d.averageRejected) + 
                  "  (Longest: " + ToString(d.longestRejected) + " -- " + ToString(d.longestRejectedIssue) + ")</li>\n";
    h = h + "<li>" + "Average time for approvals: " + ToString(d.averageApproved) + 
                  "  (Longest: " + ToString(d.longestApproved) + " -- " + ToString(d.longestApprovedIssue) + ")</li></ul>\n";
    h = h + "</ul>\n";
    h = h + "<h3>Rejections:</h3> <ul>\n";
    h = h + "<li>" + "Average number of submissions until approval: " + ToString(d.averageTurnsToApproval) +"</li>\n";
    h = h + "<li>" + "Longest number of submissions until approval: " + ToString(d.longestTurns) +  " (" + (d.longestTurnsToApproval[0].name ? "UNKNOWN") + ")</li>\n";
    h = h + "</ul>\n";
    h = h + "<h3>Resource workload:</h3> <ul>\n";
    h = h + "<li>" + "Average versions submitted per day: " + ToString(d.averageCreatedPerDay) + "</li>\n";
    h = h + "<li>" + "Average versions resolved per day: " + ToString(d.averageResolvedPerDay) + "</li>\n";
    h = h + "<li>" + "Total versions submitted: " + ToString(d.totalCreatedIssues) + "</li>\n";
    h = h + "<li>" + "Total versions resolved: " + ToString(d.totalResolvedIssues) + "</li>\n";
    h = h + "</ul>\n";
  
  
//   type: a string: one of BAR, BAR3D, BARSTK, BARSTK100, column, column3d,
//          ColumnSTK, ColumnSTK100, LINE, LINESMTH, AREA, AREASTK, AREASKT100,
//          PIE, PIEEXPL, PIE3D, PIE3DEXPL, columnline, barlinesmth, CONE, CYLINDER
 
    var data = [. title="Revisions Submitted Per Week (and current state)", type="BARSTK", legend="RIGHT", 
                  categories=ToList(d.weekly), 
                  stitle4= "Requested", series4= GetValues(d.weekly, "requested"), 
                  stitle3="In Progress", series3=GetValues(d.weekly, "inProgress"), stitle2= "Manager", series2= GetValues(d.weekly, "manager"), 
                  stitle="Completed", series=GetValues(d.weekly, "completed"),
  				  width=1200 .];    
    var chart = WubCall("chart", [data]);
    h = h + "<img src='" + chart + "'>";

    data = [. title="Average Response Times (in hours)", type="LINESMTH", legend="RIGHT", 
                  categories=ToList(d.weekly), 
                  stitle= "Completed", series= GetValues(d.weekly, "averageCompletedHours"), 
                  stitle2="Rejected", series2=GetValues(d.weekly, "averageRejectedHours"), stitle3= "Approved", series3= GetValues(d.weekly, "averageApprovedHours"),
  				  width=1200 .];    
    chart = WubCall("chart", [data]);  
    h = h + "<img src='" + chart + "'>";
    
    data = [. title="Resource Workload: Submitted vs. Resolved", type="BAR3D", legend="RIGHT", 
                  categories=ToList(d.weekly), 
                  stitle2= "New Submissions", series2= GetValues(d.weekly, "totalCreatedIssues"), 
                  stitle="Resolved", series=GetValues(d.weekly, "totalResolvedIssues"),
  				  width=1200 .];    
    chart = WubCall("chart", [data]);  
    h = h + "<img src='" + chart + "'>";
    
  
  return h;
     
  end;
  
  var s = "";
  try
     s = s + display("US", data.us);
  catch E
     on true do
        s = s + "ERROR: " + ToString(E)
  end;
  
  try  
     s = s + display("KOREA", data.kr)
   catch E
     on true do
        s = s + "ERROR: " + ToString(E)
  end;
  
</webl>
  
</html>