Centered grade
[tpope-extra.git] / perl / sctweb
index 597ce83ccd00b63ccacd7ef2fe5a03192245be85..1ca3d7c4fa6044246989c58d09c0d131d8b57db9 100755 (executable)
@@ -61,7 +61,7 @@ sub US_Labor # First Monday after the first Sunday in September
 }
 
 my $config = $ENV{HOME} . "/.sctwebrc";
-if ($ARGV[0] eq '-f') {
+if ($ARGV[0] eq '-F') {
     shift;
     $config = shift;
 }
@@ -181,6 +181,8 @@ sub off_for_exams {
        } elsif($time =~ /$ending/) {
            return $lastday-5;
        }
+    } elsif($days eq "5") {
+       return $lastday-2;
     }
     return wantarray ? () : "";
 }
@@ -230,7 +232,7 @@ sub get_schedule_terms {
     } elsif ($localtime[4]<10) { # through Oct 31
        @sterms=((1900+$localtime[5]).$a[0]);
     } else {
-       @sterms=((1900+$localtime[5])."1",(1901+$localtime[5])."2");
+       @sterms=((1900+$localtime[5]).$a[0],(1901+$localtime[5]).$a[1]);
     }
     return @sterms;
 }
@@ -557,7 +559,7 @@ sub do_html_schedule {
 
 sub do_html_grades {
     my @readheaders = ("Section ID", "Course Title", "Grade", "Earned  Hours", "Quality  Hours", "Quality  Points", "GPA");
-    my @showheaders = ("Section ID", "Course Title", "Grade", "Earned<br />Hours", "Quality<br />Hours", "Quality<br />Points", "GPA");
+    my @showheaders = ("Section ID", "Course Title", "Grade", "Earned<br />Hours", "Quality<br />Hours", "Quality<br />Points");
     my ($row, $lastrow);
     my $te = new HTML::TableExtract( headers => [ @readheaders ] );
     my $response = $ua->get("$url&tserve_tip_write=||WID|SID|PIN|Term&tserve_trans_config=rgrdterm.cfg"); # Valid grading terms
@@ -581,14 +583,19 @@ sub do_html_grades {
            $lastrow=$row;
            next if $row->[0] =~ /:/;
            print '<tr><td>';
-           print join('</td><td>', @$row);
+           print $$row[0], '</td><td>', $$row[1], '</td>';
+           print '<td align="center">', $$row[2], '</td><td>';
+           #print join('</td><td>', @$row[0 .. 1]);
+           print join('</td><td>', @$row[3 .. 5]);
            print "</td></tr>\n";
        }
     }
     print '<tr><td colspan="2">', capitalize($lastrow->[0]);
-    shift @$lastrow; shift @$lastrow;
+    #shift @$lastrow; shift @$lastrow;
     print "</td><td>";
-    print join('</td><td>', @$lastrow);
+    print $$lastrow[6];
+    print "</td><td>";
+    print join('</td><td>', @$lastrow[3 .. 5]);
     print "</td></tr>\n";
     print "</table>\n";
 }
@@ -615,7 +622,8 @@ sub do_transcripts {
     $response = $ua->get("$url&tserve_tip_write=||WID|SID|PIN&tserve_trans_config=rtranscr.cfg&CareerReqNum=1");
     foreach (split /\n/, $response->content) {
        next unless s/^\&nbsp;|<pre>// || s/\&nbsp;/ /;
-       s/<\/?[Hh]\d>//g;
+       s/<\/?([Hh]\d|[Bb])>//g;
+       next if /<\/td>/;
        print "$_\n";
     }
 }