version 1.34, 2003/06/19 20:24:57
|
version 1.35, 2003/06/25 14:42:00
|
Line 104 sub dynamicmeta {
|
Line 104 sub dynamicmeta {
|
my ($adomain,$aauthor)=($url=~/^(\w+)\/(\w+)\//); |
my ($adomain,$aauthor)=($url=~/^(\w+)\/(\w+)\//); |
my $prodir=&propath($adomain,$aauthor); |
my $prodir=&propath($adomain,$aauthor); |
if ((tie(%evaldata,'GDBM_File', |
if ((tie(%evaldata,'GDBM_File', |
$prodir.'/nohist_resevaldata.db',&GDBM_READER(),0640)) && |
$prodir.'/nohist_resevaldata.db',&GDBM_READER(),0640)) && |
(tie(%newevaldata,'GDBM_File', |
(tie(%newevaldata,'GDBM_File', |
$prodir.'/nohist_new_resevaldata.db',&GDBM_WRCREAT(),0640))) { |
$prodir.'/nohist_new_resevaldata.db',&GDBM_WRCREAT(),0640))) { |
my %sum=(); |
my %sum=(); |
my %cnt=(); |
my %cnt=(); |
my %listitems=('count' => 'add', |
my %listitems=('count' => 'add', |
'course' => 'add', |
'course' => 'add', |
'avetries' => 'avg', |
'avetries' => 'avg', |
'stdno' => 'add', |
'stdno' => 'add', |
'difficulty' => 'avg', |
'difficulty' => 'avg', |
'clear' => 'avg', |
'clear' => 'avg', |
'technical' => 'avg', |
'technical' => 'avg', |
'helpful' => 'avg', |
'helpful' => 'avg', |
'correct' => 'avg', |
'correct' => 'avg', |
'depth' => 'avg', |
'depth' => 'avg', |
'comments' => 'app', |
'comments' => 'app', |
'usage' => 'cnt' |
'usage' => 'cnt' |
); |
); |
my $regexp=$url; |
my $regexp=$url; |
$regexp=~s/(\W)/\\$1/g; |
$regexp=~s/(\W)/\\$1/g; |
$regexp='___'.$regexp.'___([a-z]+)$'; |
$regexp='___'.$regexp.'___([a-z]+)$'; |
study($regexp); |
foreach (keys %evaldata) { |
while (my ($key,$value) = each(%evaldata)) { |
my $key=&unescape($_); |
$key=&unescape($key); |
if ($key=~/$regexp/) { |
next if ($key !~ /$regexp/); |
my $ctype=$1; |
my $ctype=$1; |
|
if (defined($cnt{$ctype})) { |
if (defined($cnt{$ctype})) { |
$cnt{$ctype}++; |
$cnt{$ctype}++; |
} else { |
} else { |
$cnt{$ctype}=1; |
$cnt{$ctype}=1; |
} |
} |
unless ($listitems{$ctype} eq 'app') { |
unless ($listitems{$ctype} eq 'app') { |
if (defined($sum{$ctype})) { |
if (defined($sum{$ctype})) { |
$sum{$ctype}+=$value; |
$sum{$ctype}+=$evaldata{$_}; |
} else { |
} else { |
$sum{$ctype}=$value; |
$sum{$ctype}=$evaldata{$_}; |
} |
} |
} else { |
} else { |
if (defined($sum{$ctype})) { |
if (defined($sum{$ctype})) { |
if ($value) { |
if ($evaldata{$_}) { |
$sum{$ctype}.='<hr>'.$value; |
$sum{$ctype}.='<hr>'.$evaldata{$_}; |
} |
} |
} else { |
} else { |
$sum{$ctype}=''.$value; |
$sum{$ctype}=''.$evaldata{$_}; |
} |
} |
} |
} |
if ($ctype ne 'count') { |
if ($ctype ne 'count') { |
$newevaldata{$_}=$value; |
$newevaldata{$_}=$evaldata{$_}; |
} |
} |
} |
} |
while (my($key,$value) = each(%cnt)) { |
} |
if ($listitems{$key} eq 'avg') { |
foreach (keys %cnt) { |
$returnhash{$key}=int(($sum{$key}/$value)*100.0+0.5)/100.0; |
if ($listitems{$_} eq 'avg') { |
} elsif ($listitems{$key} eq 'cnt') { |
$returnhash{$_}=int(($sum{$_}/$cnt{$_})*100.0+0.5)/100.0; |
$returnhash{$key}=$value; |
} elsif ($listitems{$_} eq 'cnt') { |
} else { |
$returnhash{$_}=$cnt{$_}; |
$returnhash{$key}=$sum{$key}; |
} else { |
} |
$returnhash{$_}=$sum{$_}; |
} |
} |
if ($returnhash{'count'}) { |
} |
my $newkey=$$.'_'.time.'_searchcat___'.&escape($url).'___count'; |
if ($returnhash{'count'}) { |
$newevaldata{$newkey}=$returnhash{'count'}; |
my $newkey=$$.'_'.time.'_searchcat___'.&escape($url).'___count'; |
} |
$newevaldata{$newkey}=$returnhash{'count'}; |
untie(%evaldata); |
} |
untie(%newevaldata); |
untie(%evaldata); |
} |
untie(%newevaldata); |
return %returnhash; |
} |
|
return %returnhash; |
} |
} |
|
|
# ----------------- Code to enable 'find' subroutine listing of the .meta files |
# ----------------- Code to enable 'find' subroutine listing of the .meta files |
require "find.pl"; |
require "find.pl"; |
sub wanted { |
sub wanted { |