[LON-CAPA-cvs] cvs: loncom /interface lonmeta.pm
matthew
lon-capa-cvs@mail.lon-capa.org
Mon, 12 Apr 2004 21:13:13 -0000
matthew Mon Apr 12 17:13:13 2004 EDT
Modified files:
/loncom/interface lonmeta.pm
Log:
Rewrote &dynamicmeta (old version was cut & paste of old searchcat.pl) to
call lonmetadata::process_reseval_data and process_dynamic_metadata.
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.62 loncom/interface/lonmeta.pm:1.63
--- loncom/interface/lonmeta.pm:1.62 Tue Apr 6 11:07:41 2004
+++ loncom/interface/lonmeta.pm Mon Apr 12 17:13:13 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Metadata display handler
#
-# $Id: lonmeta.pm,v 1.62 2004/04/06 15:07:41 matthew Exp $
+# $Id: lonmeta.pm,v 1.63 2004/04/12 21:13:13 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -29,6 +29,7 @@
package Apache::lonmeta;
use strict;
+use LONCAPA::lonmetadata();
use Apache::Constants qw(:common);
use Apache::lonnet();
use Apache::loncommon();
@@ -54,66 +55,15 @@
$regexp='___'.$regexp.'___';
my %evaldata=&Apache::lonnet::dump('nohist_resevaldata',$adomain,
$aauthor,$regexp);
- my %sum=();
- my %cnt=();
- my %concat=();
- my %listitems=(
- 'course' => 'add',
- 'goto' => 'add',
- 'comefrom' => 'add',
- 'avetries' => 'avg',
- 'stdno' => 'add',
- 'difficulty' => 'avg',
- 'clear' => 'avg',
- 'technical' => 'avg',
- 'helpful' => 'avg',
- 'correct' => 'avg',
- 'depth' => 'avg',
- 'comments' => 'app',
- 'usage' => 'cnt'
- );
- while ($_=each(%evaldata)) {
- my ($item,$purl,$cat)=split(/___/,$_);
- ### Apache->request->print("\n".$_.' - '.$item.'<br />');
- if (defined($cnt{$cat})) { $cnt{$cat}++; } else { $cnt{$cat}=1; }
- unless ($listitems{$cat} eq 'app') {
- if (defined($sum{$cat})) {
- $sum{$cat}+=$evaldata{$_};
- $concat{$cat}.=','.$item;
- } else {
- $sum{$cat}=$evaldata{$_};
- $concat{$cat}=$item;
- }
- } else {
- if (defined($sum{$cat})) {
- if ($evaldata{$_}) {
- $sum{$cat}.='<hr />'.$evaldata{$_};
- }
- } else {
- $sum{$cat}=''.$evaldata{$_};
- }
- }
- }
- my %returnhash=();
- while ($_=each(%cnt)) {
- if ($listitems{$_} eq 'avg') {
- $returnhash{$_}=int(($sum{$_}/$cnt{$_})*100.0+0.5)/100.0;
- } elsif ($listitems{$_} eq 'cnt') {
- $returnhash{$_}=$cnt{$_};
- } else {
- $returnhash{$_}=$sum{$_};
- }
- $returnhash{$_.'_list'}=$concat{$_};
- ### Apache->request->print("\n<hr />".$_.': '.$returnhash{$_}.'<br />'.$returnhash{$_.'_list'});
- }
+ my %DynamicData = &LONCAPA::lonmetadata::process_reseval_data(\%evaldata);
+ my %Data = &LONCAPA::lonmetadata::process_dynamic_metadata($url,
+ \%DynamicData);
#
# Deal with 'count' separately
- $returnhash{'count'} = &access_count($url,$aauthor,$adomain);
+ $Data{'count'} = &access_count($url,$aauthor,$adomain);
# since "usage" is reserved word in MySQL ...
- $returnhash{'sequsage'}=$returnhash{'usage'};
- $returnhash{'sequsage_list'}=$returnhash{'usage_list'};
- return %returnhash;
+ return %Data;
}
sub access_count {