[LON-CAPA-cvs] cvs: loncom /interface lontrackstudent.pm

matthew lon-capa-cvs@mail.lon-capa.org
Thu, 30 Dec 2004 16:34:05 -0000


matthew		Thu Dec 30 11:34:05 2004 EDT

  Modified files:              
    /loncom/interface	lontrackstudent.pm 
  Log:
  &get_max_time_in_db: use lonmysql::unsqltime to convert time.
  &output_results: Tell the user when no data was returned.
  
  
Index: loncom/interface/lontrackstudent.pm
diff -u loncom/interface/lontrackstudent.pm:1.11 loncom/interface/lontrackstudent.pm:1.12
--- loncom/interface/lontrackstudent.pm:1.11	Wed Dec 22 17:54:59 2004
+++ loncom/interface/lontrackstudent.pm	Thu Dec 30 11:34:05 2004
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lontrackstudent.pm,v 1.11 2004/12/22 22:54:59 albertel Exp $
+# $Id: lontrackstudent.pm,v 1.12 2004/12/30 16:34:05 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -47,7 +47,6 @@
 use Apache::lonnet();
 use Apache::lonlocal;
 use Time::HiRes;
-use Time::Local;
 
 sub get_data {
     my ($r,$prog_state,$navmap,$mode) = @_;
@@ -178,14 +177,7 @@
         $timestr = &Apache::lonnet::unescape($line);
     }
     close(TIMEDATA);
-    my ($year,$month,$day,$hour,$min,$sec) = 
-        ($timestr =~ /^(\d+)-(\d+)-(\d+) (\d+):(\d+):(\d+)/);
-    $month -= 1; # Good old timelocal
-    my $max_time = undef;
-    if (eval("&timelocal($sec,$min,$hour,$day,$month,$year)")) {
-        $max_time = &timelocal($sec,$min,$hour,$day,$month,$year);
-    }
-    return $max_time;
+    return &Apache::lonmysql::unsqltime($timestr);
 }
 
 sub build_query {
@@ -232,6 +224,11 @@
     my ($r,$results_file,$navmap,$mode) = @_;
     ##
     ##
+    if (! -s $results_file) {
+        # results file is empty, just let them know there is no data
+        $r->print('<h2>'.&mt('No data was returned for your request').'</h2>');
+        return;
+    }
     if (! open(ACTIVITYDATA,$results_file)) {
         $r->print('<h2>'.&mt('Unable to read results file.').'</h2>'.
                   '<p>'.