Diff for /loncom/interface/loncoursedata.pm between versions 1.180 and 1.181

version 1.180, 2007/01/16 22:50:12 version 1.181, 2007/04/03 20:04:54
Line 38  Set of functions that download and proce Line 38  Set of functions that download and proce
   
 =head1 PACKAGES USED  =head1 PACKAGES USED
   
  Apache::Constants qw(:common :http)    Apache::lonnet
  Apache::lonnet()    Apache::longroup
  Apache::lonhtmlcommon    Time::HiRes
  HTML::TokeParser    Apache::lonmysql
  GDBM_File    LONCAPA
     Digest::MD5
    
 =cut  =cut
   
 package Apache::loncoursedata;  package Apache::loncoursedata;
   
 use strict;  use strict;
 use Apache::lonnet;  use Apache::lonnet;
 use Apache::lonhtmlcommon;  use Apache::longroup();
 use Apache::longroup;  use Time::HiRes();
 use Time::HiRes;  use Apache::lonmysql();
 use Apache::lonmysql;  
 use HTML::TokeParser;  
 use GDBM_File;  
 use lib '/home/httpd/lib/perl/';  
 use LONCAPA;  use LONCAPA;
   use Digest::MD5();
   
 =pod  =pod
   
Line 2007  sub get_problem_statistics { Line 2005  sub get_problem_statistics {
     &setup_table_names($courseid);      &setup_table_names($courseid);
     my $symb_id = &get_symb_id($symb);      my $symb_id = &get_symb_id($symb);
     my $part_id = &get_part_id($part);      my $part_id = &get_part_id($part);
     my $stats_table = $courseid.'_problem_stats';      my $stats_table = &temp_table_name($courseid,'problem_stats');
     #      #
     my $dbh = &Apache::lonmysql::get_dbh();      my $dbh = &Apache::lonmysql::get_dbh();
     return undef if (! defined($dbh));      return undef if (! defined($dbh));
Line 2520  sub score_stats { Line 2518  sub score_stats {
     my $time_limits = &limit_by_start_end_time($starttime,$endtime,'a');      my $time_limits = &limit_by_start_end_time($starttime,$endtime,'a');
     my @Symbids = map { &get_symb_id($_); } @{$symbs};      my @Symbids = map { &get_symb_id($_); } @{$symbs};
     #      #
     my $stats_table = $courseid.'_problem_stats';      my $stats_table = &temp_table_name($courseid,'problem_stats');
     my $symb_restriction = join(' OR ',map {'a.symb_id='.$_;} @Symbids);      my $symb_restriction = join(' OR ',map {'a.symb_id='.$_;} @Symbids);
     my $request = 'DROP TABLE '.$stats_table;      my $request = 'DROP TABLE '.$stats_table;
     $dbh->do($request);      $dbh->do($request);
Line 2599  sub count_stats { Line 2597  sub count_stats {
     my $time_limits = &limit_by_start_end_time($starttime,$endtime,'a');      my $time_limits = &limit_by_start_end_time($starttime,$endtime,'a');
     my @Symbids = map { &get_symb_id($_); } @{$symbs};      my @Symbids = map { &get_symb_id($_); } @{$symbs};
     #      #
     my $stats_table = $courseid.'_problem_stats';      my $stats_table = &temp_table_name($courseid,'problem_stats');
     my $symb_restriction = join(' OR ',map {'a.symb_id='.$_;} @Symbids);      my $symb_restriction = join(' OR ',map {'a.symb_id='.$_;} @Symbids);
     my $request = 'DROP TABLE '.$stats_table;      my $request = 'DROP TABLE '.$stats_table;
     $dbh->do($request);      $dbh->do($request);
Line 2897  sub get_student_scores { Line 2895  sub get_student_scores {
     &setup_table_names($courseid);      &setup_table_names($courseid);
     my $dbh = &Apache::lonmysql::get_dbh();      my $dbh = &Apache::lonmysql::get_dbh();
     return (undef) if (! defined($dbh));      return (undef) if (! defined($dbh));
     my $tmptable = $courseid.'_temp_'.time;      my $tmptable = &temp_table_name($courseid,'temp_'.time);
     my $request = 'DROP TABLE IF EXISTS '.$tmptable;      my $request = 'DROP TABLE IF EXISTS '.$tmptable;
 #    &Apache::lonnet::logthis('request = '.$/.$request);  #    &Apache::lonnet::logthis('request = '.$/.$request);
     $dbh->do($request);      $dbh->do($request);
Line 3009  sub setup_table_names { Line 3007  sub setup_table_names {
     }      }
     #      #
     # Set up database names      # Set up database names
     my $base_id = $courseid;      my $base_id = 'md5_'.&Digest::MD5::md5_hex($courseid);
     $symb_table               = $base_id.'_'.'symb';      $symb_table               = $base_id.'_'.'symb';
     $part_table               = $base_id.'_'.'part';      $part_table               = $base_id.'_'.'part';
     $student_table            = $base_id.'_'.'student';      $student_table            = $base_id.'_'.'student';
Line 3038  sub setup_table_names { Line 3036  sub setup_table_names {
     return;      return;
 }  }
   
   sub temp_table_name {
       my ($courseid,$affix) = @_;
       my $base_id = 'md5_'.&Digest::MD5::md5_hex($courseid);
       return $base_id.'_'.$affix;
   }
   
 ################################################  ################################################
 ################################################  ################################################
   

Removed from v.1.180  
changed lines
  Added in v.1.181


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>