[LON-CAPA-cvs] cvs: modules /matthew/accesscounts update_accesscounts.pl

matthew lon-capa-cvs@mail.lon-capa.org
Fri, 14 Nov 2003 21:55:25 -0000


matthew		Fri Nov 14 16:55:25 2003 EDT

  Added files:                 
    /modules/matthew/accesscounts	update_accesscounts.pl 
  Log:
  Script to update nohist_accesscount.db's for a given class.  A bit of a mess.
  
  

Index: modules/matthew/accesscounts/update_accesscounts.pl
+++ modules/matthew/accesscounts/update_accesscounts.pl
#!/usr/bin/perl -w
use strict;

sub propath {
    my ($uname)=@_;
    my $subdir=$uname.'__';
    $subdir =~ s/(.)(.)(.).*/$1\/$2\/$3/;
    my $proname="/home/httpd/lonUsers/msu/$subdir/$uname";
    return $proname;
} 

my %Associations = ('physicslib' =>
#  10331ca4d453f6bmsul1  Champ 2003
#  11821dad1863f17msul1  MAAPT 2003
#  1324287903f3b14msul1  LBS 271 Fall 2001
#  13265de068a3e8fmsul1  PHY 184B - Summer 2003
#  15391b6b4333fcdmsul1  PHY 231 - Fall 2003
#  17202b8b6153e16msul1  PHY 183 - Spring 2003
#  1794127708d3f7bmsua4  Champ Demo
#  180001d82523d66msul1  Champ 2002
#  18012fa33133f05msul1  PHY 232C - Fall 2003
#  18013372a133ff6msul1  PHY 233B - Fall 2003
#  18014522a133f7dmsul1  PHY 234B - Fall 2003
#  183710034ab3c22msul1  MSU Physics Library
#  18886ae2e5d3e10msul1  Testing
#  189305c49833e5dmsul1  PHY 183B - Summer 2003
#  201337e5e323fa4msul1  PHY 232 - Fall 2003
#  254388780673f62msul1  EXAM --- PHY 184 - Fall 2003
#  290321abe163f8amsul1  PHY 184 - Fall 2003
#  2964385f9033c63msul1  PHY 183 SS02
#  34381da952a3f1amsul1  LBS 271 - Fall 2003
#  64798c8b1bb3a84msul1  Ed's Test Class
#  69151e9f93c3d42msul1  LON-CAPA Demo Course
#  962516599a93edbmsul1  PHY 233B - Summer
                    [qw/
                     11821dad1863f17msul1
                     1324287903f3b14msul1
                     13265de068a3e8fmsul1
                     15391b6b4333fcdmsul1
                     17202b8b6153e16msul1
                     1794127708d3f7bmsua4
                     180001d82523d66msul1
                     18012fa33133f05msul1
                     18013372a133ff6msul1
                     18014522a133f7dmsul1
                     183710034ab3c22msul1
                     18886ae2e5d3e10msul1
                     189305c49833e5dmsul1
                     201337e5e323fa4msul1
                     254388780673f62msul1
                     290321abe163f8amsul1
                     2964385f9033c63msul1
                     34381da952a3f1amsul1
                     64798c8b1bb3a84msul1
                     69151e9f93c3d42msul1
                     962516599a93edbmsul1
                     /
                    ]
);

while (my($user,$classarray) = each(%Associations)) {
    my $userpath = &propath($user);
    print STDERR 'seeding nohist_accesscount.db for '.$user.$/;
#    system("~/utils/seed_accesscount.pl $userpath/nohist_resevaldata.db");
    my $numcourses = scalar(@$classarray);
    my $count = 0;
    foreach my $course (@$classarray) {
        my $coursepath = &propath($course);
        print STDERR 'processing '.(++$count).' / '.$numcourses.' : '.$course.$/;
        system("~/utils/activity_to_accesscount.pl ".
               "$coursepath/activity.log ".
               "$userpath/nohist_accesscount.db");
    }
}