version 1.47, 2003/12/25 04:06:52
|
version 1.49, 2003/12/25 15:20:00
|
Line 56 This script also does general database m
|
Line 56 This script also does general database m
|
the C<loncapa:metadata> table if it is deprecated. |
the C<loncapa:metadata> table if it is deprecated. |
|
|
This script evaluates dynamic metadata from the authors' |
This script evaluates dynamic metadata from the authors' |
F<nohist_resevaldata.db> database file in order to store it in MySQL, as |
F<nohist_resevaldata.db> database file in order to store it in MySQL. |
well as to compress the filesize (add up all "count"-type metadata). |
|
|
|
This script is playing an increasingly important role for a loncapa |
This script is playing an increasingly important role for a loncapa |
library server. The proper operation of this script is critical for a smooth |
library server. The proper operation of this script is critical for a smooth |
Line 131 sub escape {
|
Line 130 sub escape {
|
sub dynamicmeta { |
sub dynamicmeta { |
my $url=&declutter(shift); |
my $url=&declutter(shift); |
$url=~s/\.meta$//; |
$url=~s/\.meta$//; |
my %returnhash=(); |
my %returnhash=( |
|
'count' => 0, |
|
'course' => 0, |
|
'course_list' => '', |
|
'avetries' => 'NULL', |
|
'avetries_list' => '', |
|
'stdno' => 0, |
|
'stdno_list' => '', |
|
'usage' => 0, |
|
'usage_list' => '', |
|
'goto' => 0, |
|
'goto_list' => '', |
|
'comefrom' => 0, |
|
'comefrom_list' => '', |
|
'difficulty' => 'NULL', |
|
'difficulty_list' => '', |
|
'clear' => 'NULL', |
|
'technical' => 'NULL', |
|
'correct' => 'NULL', |
|
'helpful' => 'NULL', |
|
'depth' => 'NULL', |
|
'comments' => '' |
|
); |
my ($adomain,$aauthor)=($url=~/^(\w+)\/(\w+)\//); |
my ($adomain,$aauthor)=($url=~/^(\w+)\/(\w+)\//); |
my $prodir=&propath($adomain,$aauthor); |
my $prodir=&propath($adomain,$aauthor); |
|
|
Line 187 sub dynamicmeta {
|
Line 208 sub dynamicmeta {
|
untie(%evaldata); |
untie(%evaldata); |
# transfer gathered data to returnhash, calculate averages where applicable |
# transfer gathered data to returnhash, calculate averages where applicable |
while (my $cat=each(%cnt)) { |
while (my $cat=each(%cnt)) { |
|
if ($cnt{$cat} eq 'nan') { next; } |
|
if ($sum{$cat} eq 'nan') { next; } |
if ($listitems{$cat} eq 'avg') { |
if ($listitems{$cat} eq 'avg') { |
$returnhash{$cat}=int(($sum{$cat}/$cnt{$cat})*100.0+0.5)/100.0; |
if ($cnt{$cat}) { |
|
$returnhash{$cat}=int(($sum{$cat}/$cnt{$cat})*100.0+0.5)/100.0; |
|
} else { |
|
$returnhash{$cat}='NULL'; |
|
} |
} elsif ($listitems{$cat} eq 'cnt') { |
} elsif ($listitems{$cat} eq 'cnt') { |
$returnhash{$cat}=$cnt{$cat}; |
$returnhash{$cat}=$cnt{$cat}; |
} else { |
} else { |
Line 260 my $dbh;
|
Line 287 my $dbh;
|
"course INTEGER UNSIGNED, course_list TEXT, ". |
"course INTEGER UNSIGNED, course_list TEXT, ". |
"goto INTEGER UNSIGNED, goto_list TEXT, ". |
"goto INTEGER UNSIGNED, goto_list TEXT, ". |
"comefrom INTEGER UNSIGNED, comefrom_list TEXT, ". |
"comefrom INTEGER UNSIGNED, comefrom_list TEXT, ". |
"fusage INTEGER UNSIGNED, fusage_list TEXT, ". |
"sequsage INTEGER UNSIGNED, sequsage_list TEXT, ". |
"stdno INTEGER UNSIGNED, stdno_list TEXT, ". |
"stdno INTEGER UNSIGNED, stdno_list TEXT, ". |
"avetries FLOAT, avetries_list TEXT, ". |
"avetries FLOAT, avetries_list TEXT, ". |
"difficulty FLOAT, difficulty_list TEXT, ". |
"difficulty FLOAT, difficulty_list TEXT, ". |
|
"clear FLOAT, technical FLOAT, correct FLOAT, helpful FLOAT, depth FLOAT, ". |
|
"comments TEXT, ". |
"FULLTEXT idx_title (title), ". |
"FULLTEXT idx_title (title), ". |
"FULLTEXT idx_author (author), FULLTEXT idx_subject (subject), ". |
"FULLTEXT idx_author (author), FULLTEXT idx_subject (subject), ". |
"FULLTEXT idx_url (url), FULLTEXT idx_keywords (keywords), ". |
"FULLTEXT idx_url (url), FULLTEXT idx_keywords (keywords), ". |
Line 319 my $insert_sth = $dbh->prepare
|
Line 348 my $insert_sth = $dbh->prepare
|
"?,". # avetries |
"?,". # avetries |
"?,". # avetries_list |
"?,". # avetries_list |
"?,". # difficulty |
"?,". # difficulty |
"?," # difficulty_list |
"?,". # difficulty_list |
|
"?,". # clear |
|
"?,". # technical |
|
"?,". # correct |
|
"?,". # helpful |
|
"?,". # depth |
|
"?". # comments |
|
")" |
); |
); |
|
|
foreach my $user (@homeusers) { |
foreach my $user (@homeusers) { |
Line 371 foreach my $user (@homeusers) {
|
Line 407 foreach my $user (@homeusers) {
|
$dyn{'avetries'}, |
$dyn{'avetries'}, |
$dyn{'avetries_list'}, |
$dyn{'avetries_list'}, |
$dyn{'difficulty'}, |
$dyn{'difficulty'}, |
$dyn{'difficulty_list'} |
$dyn{'difficulty_list'}, |
|
$dyn{'clear'}, |
|
$dyn{'technical'}, |
|
$dyn{'correct'}, |
|
$dyn{'helpful'}, |
|
$dyn{'depth'}, |
|
$dyn{'comments'} |
)) { |
)) { |
print LOG "\nMySQL Error Insert: ".$dbh->errstr."\n"; |
print LOG "\nMySQL Error Insert: ".$dbh->errstr."\n"; |
die $dbh->errstr; |
die $dbh->errstr; |