Allow for no "cumulative" line
authorTim Pope <code@tpope.net>
Mon, 12 Dec 2005 03:33:14 +0000 (03:33 +0000)
committerTim Pope <code@tpope.net>
Mon, 12 Dec 2005 03:33:14 +0000 (03:33 +0000)
perl/schedproc

index 81f4a1a..2a80bc3 100755 (executable)
@@ -586,13 +586,15 @@ sub do_html_grades {
            print "</td></tr>\n";
        }
     }
-    my $lastrow = $grades->{'cumulative'}->[scalar @{$grades->{'cumulative'}}-1];
-    print '<tr class="cumulative '.$shade.'"><td id="cumulative" colspan="2">Cumulative: through ', capitalize($lastrow->{'term'});
-    print '</td><td align="center" id="gpa" class="grade">';
-    print $lastrow->{'gpa'};
-    print '</td><td align="right" class="right-number">';
-    print join('</td><td align="right" class="right-number">', ($lastrow->{'earned'}, $lastrow->{'hours'}, $lastrow->{'points'}));
-    print "</td></tr>\n";
+    if(exists($grades->{'cumulative'})) {
+        my $lastrow = $grades->{'cumulative'}->[scalar @{$grades->{'cumulative'}}-1];
+        print '<tr class="cumulative '.$shade.'"><td id="cumulative" colspan="2">Cumulative: through ', capitalize($lastrow->{'term'});
+        print '</td><td align="center" id="gpa" class="grade">';
+        print $lastrow->{'gpa'};
+        print '</td><td align="right" class="right-number">';
+        print join('</td><td align="right" class="right-number">', ($lastrow->{'earned'}, $lastrow->{'hours'}, $lastrow->{'points'}));
+        print "</td></tr>\n";
+    }
     print "</table>\n";
     select STDOUT;
 }