'."\n".
''."\n".
''.
@@ -931,7 +934,7 @@ sub sequence_html_header {
sub sequence_html_output {
my ($seq) = @_;
- my $data = $SeqStat{$seq->{'symb'}};
+ my $data = $SeqStat{$seq->symb};
my $row = ' ';
foreach my $field (@SeqFields) {
next if ($field->{'selected'} ne 'yes');
@@ -1343,9 +1346,8 @@ sub Excel_output {
##
&write_headers($excel_sheet,$format,\$rows_output,\$cols_output,
\@SeqFields);
- foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
- next if ($seq->{'num_assess'} < 1);
- my $data = $SeqStat{$seq->{'symb'}};
+ foreach my $seq (@sequences) {
+ my $data = $SeqStat{$seq->symb};
$cols_output=0;
foreach my $field (@SeqFields) {
next if ($field->{'selected'} ne 'yes');
@@ -1441,10 +1443,9 @@ sub write_headers {
sub compute_statistics_on_sequence {
my ($seq) = @_;
my @Data;
- foreach my $res (@{$seq->{'contents'}}) {
- next if ($res->{'type'} ne 'assessment');
- foreach my $part (@{$res->{'parts'}}) {
- next if ($res->{'partdata'}->{$part}->{'Survey'});
+ foreach my $res (&Apache::lonstathelpers::get_resources($navmap,$seq)) {
+ foreach my $part (@{$res->parts}) {
+ next if ($res->is_survey($part));
#
# This is where all the work happens
my $data = &get_statistics($seq,$res,$part,scalar(@StatsArray)+1);
@@ -1462,9 +1463,8 @@ sub compute_all_statistics {
return;
}
my $c = $r->connection;
- foreach my $seq (&Apache::lonstatistics::Sequences_with_Assess()) {
+ foreach my $seq (@sequences) {
last if ($c->aborted);
- next if ($seq->{'num_assess'} < 1);
&compute_sequence_statistics($seq);
&compute_statistics_on_sequence($seq);
}
@@ -1551,7 +1551,7 @@ sub get_statistics {
my ($sequence,$resource,$part,$problem_num) = @_;
#
my ($starttime,$endtime) = &Apache::lonstathelpers::get_time_limits();
- my $symb = $resource->{'symb'};
+ my $symb = $resource->symb;
my $courseid = $ENV{'request.course.id'};
#
my $data = &Apache::loncoursedata::get_problem_statistics
@@ -1561,10 +1561,10 @@ sub get_statistics {
$data->{'symb'} = $symb;
$data->{'part'} = $part;
$data->{'problem_num'} = $problem_num;
- $data->{'container'} = $sequence->{'title'};
- $data->{'title'} = $resource->{'title'};
- $data->{'title.link'} = $resource->{'src'}.'?symb='.
- &Apache::lonnet::escape($resource->{'symb'});
+ $data->{'container'} = $sequence->compTitle;
+ $data->{'title'} = $resource->compTitle;
+ $data->{'title.link'} = $resource->src.'?symb='.
+ &Apache::lonnet::escape($resource->symb);
#
if ($SelectedFields{'deg_of_disc'}) {
$data->{'deg_of_disc'} =
@@ -1578,7 +1578,7 @@ sub get_statistics {
$sections =~ s/&+/_/g; # Ensure no special characters
$data->{'sections'}=$sections;
$data->{'course'} = $ENV{'request.course.id'};
- my $urlres=(&Apache::lonnet::decode_symb($resource->{'symb'}))[2];
+ my $urlres=(&Apache::lonnet::decode_symb($resource->symb))[2];
$data->{'urlres'}=$urlres;
my %storestats =
&LONCAPA::lonmetadata::dynamic_metadata_storage($data);
@@ -1620,11 +1620,12 @@ Returns: integer between -1 and 1
###############################################
###############################################
sub compute_discrimination_factor {
- my ($resource,$part,$sequence) = @_;
+ my ($resource,$part,$seq) = @_;
+ my $symb = $resource->symb;
my @Resources;
- foreach my $res (@{$sequence->{'contents'}}) {
- next if ($res->{'symb'} eq $resource->{'symb'});
- push (@Resources,$res->{'symb'});
+ foreach my $res (&Apache::lonstathelpers::get_resources($navmap,$seq)){
+ next if ($res->symb eq $symb);
+ push (@Resources,$res->symb);
}
#
# rank
@@ -1650,10 +1651,10 @@ sub compute_discrimination_factor {
return 'nan';
}
my ($bottom_sum,$bottom_max) =
- &Apache::loncoursedata::get_sum_of_scores($resource,$part,\@BottomSet,
+ &Apache::loncoursedata::get_sum_of_scores($symb,$part,\@BottomSet,
undef,$starttime,$endtime);
my ($top_sum,$top_max) =
- &Apache::loncoursedata::get_sum_of_scores($resource,$part,\@TopSet,
+ &Apache::loncoursedata::get_sum_of_scores($symb,$part,\@TopSet,
undef,$starttime,$endtime);
my $deg_of_disc;
if ($top_max == 0 || $bottom_max==0) {
@@ -1685,11 +1686,12 @@ sub compute_discrimination_factor {
###############################################
sub compute_sequence_statistics {
my ($seq) = @_;
- my $symb = $seq->{'symb'};
+ my $symb = $seq->symb;
my @Resources;
- foreach my $res (@{$seq->{'contents'}}) {
- next if ($res->{'type'} ne 'assessment');
- push (@Resources,$res->{'symb'});
+ my $part_count;
+ foreach my $res (&Apache::lonstathelpers::get_resources($navmap,$seq)) {
+ push (@Resources,$res->symb);
+ $part_count += scalar(@{$res->parts});
}
my ($starttime,$endtime) = &Apache::lonstathelpers::get_time_limits();
#
@@ -1699,7 +1701,7 @@ sub compute_sequence_statistics {
(\@Apache::lonstatistics::SelectedSections,
$Apache::lonstatistics::enrollment_status,
\@Resources,$starttime,$endtime,undef);
- $SeqStat{$symb}->{'title'} = $seq->{'title'};
+ $SeqStat{$symb}->{'title'} = $seq->compTitle;
$SeqStat{$symb}->{'scoremax'} = $smax;
$SeqStat{$symb}->{'scoremin'} = $smin;
$SeqStat{$symb}->{'scoremean'} = $sMean;
@@ -1714,7 +1716,7 @@ sub compute_sequence_statistics {
(\@Apache::lonstatistics::SelectedSections,
$Apache::lonstatistics::enrollment_status,
\@Resources,$starttime,$endtime,undef);
- my $K = $seq->{'num_assess_parts'};
+ my $K = $part_count;
my $kr_21;
if ($K > 1 && $cSTD > 0) {
$kr_21 = ($K/($K-1)) * (1 - $cMean*($K-$cMean)/($K*$cSTD**2));
|