[LON-CAPA-cvs] cvs: modules /gerd/geogebra timesinter.pl
www
www at source.lon-capa.org
Tue Nov 1 13:07:04 EDT 2011
www Tue Nov 1 17:07:04 2011 EDT
Added files:
/modules/gerd/geogebra timesinter.pl
Log:
Time interval evaluation
Index: modules/gerd/geogebra/timesinter.pl
+++ modules/gerd/geogebra/timesinter.pl
use strict;
my %symbtitle=();
my @symborder=();
open(IN,"symbs.dat");
while (my $line=<IN>) {
chomp($line);
my ($title,$symb)=($line=~/^(.+)\s+(uploaded.+)$/);
$symbtitle{$symb}=$title;
push(@symborder,$symb);
}
close(IN);
# Time on task averages
my %tottime=();
# Time between transactions
my %tbw=();
my %interval=();
my %parts=();
my %total=();
# Read stuff
open(IN,"processed_times.dat");
while (my $line=<IN>) {
chomp($line);
my ($key,$value)=split(/\=/,$line);
my ($first,$last,$submissions)=split(/\:/,$value);
$submissions=~s/^\,//;
my @subs=split(/\,/,$submissions);
#
my $timeontask=$last-$first;
if ($timeontask) {
$tottime{$key}=$timeontask;
}
for (my $i=0; $i<$#subs; $i++) {
my $timebetween=$subs[$i+1]-$subs[$i];
if ($timebetween) {
$interval{(split(/\:/,$key))[0].':'.(split(/\:/,$key))[1].':'.int($timebetween/5.)}++;
$parts{(split(/\:/,$key))[0]}.=','.(split(/\:/,$key))[1];
$total{(split(/\:/,$key))[0].':'.(split(/\:/,$key))[1]}++;
}
}
}
close(IN);
foreach my $symb (@symborder) {
my $lastpart='';
foreach my $part (sort(split(/\,/,$parts{$symb}))) {
unless ($part) { next; }
if ($part eq $lastpart) { next; }
$lastpart=$part;
print '"'.$symbtitle{$symb}.'",'.$part;
for (my $i=0; $i<=119; $i++) {
my $tot=100.*$interval{$symb.':'.$part.':'.$i}/$total{$symb.':'.$part};
print ','.$tot;
}
print "\n";
}
}
sub escape {
my $str=shift;
$str =~ s/(\W)/"%".unpack('H2',$1)/eg;
return $str;
}
# ----------------------------------------------------- Un-Escape Special Chars
sub unescape {
my $str=shift;
$str =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
return $str;
}
More information about the LON-CAPA-cvs
mailing list