version 1.16, 2007/01/02 12:53:27
|
version 1.21, 2007/05/12 23:24:56
|
Line 184 $Portfolio_metadata_table_description =
|
Line 184 $Portfolio_metadata_table_description =
|
{ name => 'domain', type=>'TEXT'}, |
{ name => 'domain', type=>'TEXT'}, |
{ name => 'groupname', type=>'TEXT'}, |
{ name => 'groupname', type=>'TEXT'}, |
{ name => 'courserestricted', type=>'TEXT'}, |
{ name => 'courserestricted', type=>'TEXT'}, |
{ name => 'addedfieldnames', type=>'TEXT'}, |
|
{ name => 'addedfieldvalues', type=>'TEXT'}, |
|
#-------------------------------------------------- |
#-------------------------------------------------- |
{ name => 'dependencies', type=>'TEXT'}, |
{ name => 'dependencies', type=>'TEXT'}, |
{ name => 'modifyinguser', type=>'TEXT'}, |
{ name => 'modifyinguser', type=>'TEXT'}, |
Line 797 sub process_dynamic_metadata {
|
Line 795 sub process_dynamic_metadata {
|
# Get the statistical data - Use a weighted average |
# Get the statistical data - Use a weighted average |
foreach my $type (qw/avetries difficulty disc/) { |
foreach my $type (qw/avetries difficulty disc/) { |
my $studentcount; |
my $studentcount; |
|
my %course_counted; |
my $sum; |
my $sum; |
my @Values; |
my @Values; |
my @Students; |
my @Students; |
# |
# |
# Old data |
# New data |
foreach my $coursedata (values(%{$resdata->{'statistics'}}), |
|
values(%{$resdata->{'stats'}})) { |
|
if (ref($coursedata) eq 'HASH' && exists($coursedata->{$type})) { |
|
$studentcount += $coursedata->{'stdno'}; |
|
$sum += ($coursedata->{$type}*$coursedata->{'stdno'}); |
|
push(@Values,$coursedata->{$type}); |
|
push(@Students,$coursedata->{'stdno'}); |
|
} |
|
} |
|
if (exists($resdata->{'stats'})) { |
if (exists($resdata->{'stats'})) { |
foreach my $identifier (sort(keys(%{$resdata->{'stats'}}))) { |
foreach my $identifier (sort(keys(%{$resdata->{'stats'}}))) { |
my $coursedata = $resdata->{'stats'}->{$identifier}; |
my $coursedata = $resdata->{'stats'}->{$identifier}; |
|
next if (lc($coursedata->{$type}) eq 'nan'); |
|
$course_counted{$coursedata->{'course'}}++; |
$studentcount += $coursedata->{'stdno'}; |
$studentcount += $coursedata->{'stdno'}; |
$sum += $coursedata->{$type}*$coursedata->{'stdno'}; |
$sum += $coursedata->{$type}*$coursedata->{'stdno'}; |
push(@Values,$coursedata->{$type}); |
push(@Values,$coursedata->{$type}); |
Line 821 sub process_dynamic_metadata {
|
Line 813 sub process_dynamic_metadata {
|
} |
} |
} |
} |
# |
# |
# New data |
# Old data |
|
foreach my $course (keys(%{$resdata->{'statistics'}})) { |
|
next if (exists($course_counted{$course})); |
|
my $coursedata = $resdata->{'statistics'}{$course}; |
|
if (ref($coursedata) eq 'HASH' && exists($coursedata->{$type})) { |
|
next if (lc($coursedata->{$type}) eq 'nan'); |
|
$studentcount += $coursedata->{'stdno'}; |
|
$sum += ($coursedata->{$type}*$coursedata->{'stdno'}); |
|
push(@Values,$coursedata->{$type}); |
|
push(@Students,$coursedata->{'stdno'}); |
|
} |
|
} |
if (defined($studentcount) && $studentcount>0) { |
if (defined($studentcount) && $studentcount>0) { |
$data{$type} = $sum/$studentcount; |
$data{$type} = $sum/$studentcount; |
$data{$type.'_list'} = join(',',@Values); |
$data{$type.'_list'} = join(',',@Values); |
Line 830 sub process_dynamic_metadata {
|
Line 833 sub process_dynamic_metadata {
|
# |
# |
# Find out the number of students who have completed the resource... |
# Find out the number of students who have completed the resource... |
my $stdno; |
my $stdno; |
foreach my $coursedata (values(%{$resdata->{'statistics'}}), |
my %course_counted; |
values(%{$resdata->{'stats'}})) { |
|
if (ref($coursedata) eq 'HASH' && exists($coursedata->{'stdno'})) { |
|
$stdno += $coursedata->{'stdno'}; |
|
} |
|
} |
|
if (exists($resdata->{'stats'})) { |
if (exists($resdata->{'stats'})) { |
# |
# |
# For the number of students, take the maximum found for the class |
# For the number of students, take the maximum found for the class |
Line 848 sub process_dynamic_metadata {
|
Line 846 sub process_dynamic_metadata {
|
} |
} |
if ($current_course ne $coursedata->{'course'}) { |
if ($current_course ne $coursedata->{'course'}) { |
$stdno += $coursemax; |
$stdno += $coursemax; |
|
$course_counted{$coursedata->{'course'}}++; |
$coursemax = 0; |
$coursemax = 0; |
$current_course = $coursedata->{'course'}; |
$current_course = $coursedata->{'course'}; |
} |
} |
Line 857 sub process_dynamic_metadata {
|
Line 856 sub process_dynamic_metadata {
|
} |
} |
$stdno += $coursemax; # pick up the final course in the list |
$stdno += $coursemax; # pick up the final course in the list |
} |
} |
|
# check for old data that has not been run since the format was changed |
|
foreach my $course (keys(%{$resdata->{'statistics'}})) { |
|
next if (exists($course_counted{$course})); |
|
my $coursedata = $resdata->{'statistics'}{$course}; |
|
if (ref($coursedata) eq 'HASH' && exists($coursedata->{'stdno'})) { |
|
$stdno += $coursedata->{'stdno'}; |
|
} |
|
} |
$data{'stdno'}=$stdno; |
$data{'stdno'}=$stdno; |
# |
# |
# Get the context data |
# Get the context data |
Line 994 sub portfolio_metadata {
|
Line 1001 sub portfolio_metadata {
|
} |
} |
} # End of ($token->[0] eq 'S') |
} # End of ($token->[0] eq 'S') |
} |
} |
if (keys(%addedfields) > 0) { |
|
foreach my $key (sort keys(%addedfields)) { |
|
$metacache{'addedfieldnames'} .= $key.','; |
|
$metacache{'addedfieldvalues'} .= $addedfields{$key}.'&&&'; |
|
} |
|
$metacache{'addedfieldnames'} =~ s/,$//; |
|
$metacache{'addedfieldvalues'} =~ s/\&\&\&$//; |
|
if ($metacache{'keys'}) { |
|
$metacache{'keys'}.=',addedfieldnames'; |
|
} else { |
|
$metacache{'keys'}='addedfieldnames'; |
|
} |
|
$metacache{'keys'}.=',addedfieldvalues'; |
|
} |
|
return (\%metacache,$metacache{'courserestricted'},\%addedfields); |
return (\%metacache,$metacache{'courserestricted'},\%addedfields); |
} |
} |
|
|
Line 1127 sub process_portfolio_metadata {
|
Line 1120 sub process_portfolio_metadata {
|
###################################################################### |
###################################################################### |
###################################################################### |
###################################################################### |
|
|
## Utilities originally in searchcat.pl. Moved to be more widely available. |
|
|
|
sub getfile { |
sub getfile { |
my $file = shift(); |
my $file = shift(); |
if (! -e $file ) { |
if (! -e $file ) { |
return undef; |
return undef; |
} |
} |
my $fh=IO::File->new($file); |
open(my $fh,"<$file"); |
my $contents = ''; |
my $contents = ''; |
while (<$fh>) { |
while (<$fh>) { |
$contents .= $_; |
$contents .= $_; |