[LON-CAPA-cvs] cvs: modules /gerd/harvesting bydaycount.pl

www www@source.lon-capa.org
Fri, 24 Jun 2011 21:32:13 -0000


www		Fri Jun 24 21:32:13 2011 EDT

  Added files:                 
    /modules/gerd/harvesting	bydaycount.pl 
  Log:
  Counts currently enrolled users
  
  

Index: modules/gerd/harvesting/bydaycount.pl
+++ modules/gerd/harvesting/bydaycount.pl
use strict;

my $year=31556926.;
my $month=$year/12.;
my $add=1./12.;
my $twothousand=946684800;
print localtime($twothousand)."\n";
my $date=$twothousand;
my $adddate=2000.;
for (my $i=1;$i<=140;$i++) {
my %students=();
open(IN,"matrix/allstudents.dat");
my $count=0;
while (my $line=<IN>) {
    chomp($line);
    my @entries=split(/\:/,$line);
# start
    unless ($entries[5]) { next; }
    if ($entries[5]>$date) { next; }
# end
    unless ($entries[4]) { next; }
    if ($entries[4]<$date) { next; } 
    $count++;
    $students{$entries[2].':'.$entries[3]}=1;
}
close(IN);
my @stud=keys(%students);
print localtime($date)."\t$adddate\t$count\t$#stud\n";
$date+=$month;
$adddate+=$add;
}