version 1.20, 2007/05/12 23:03:30
|
version 1.21, 2007/05/12 23:24:56
|
Line 795 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 819 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); |