--- loncom/interface/statistics/lonproblemanalysis.pm 2004/01/28 14:53:34 1.62 +++ loncom/interface/statistics/lonproblemanalysis.pm 2004/10/29 16:13:45 1.100 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: lonproblemanalysis.pm,v 1.62 2004/01/28 14:53:34 matthew Exp $ +# $Id: lonproblemanalysis.pm,v 1.100 2004/10/29 16:13:45 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -33,7 +33,8 @@ use Apache::lonhtmlcommon(); use Apache::loncoursedata(); use Apache::lonstatistics; use Apache::lonlocal; -use Apache::lonstathelpers; +use Apache::lonstathelpers(); +use Apache::lonstudentsubmissions(); use HTML::Entities(); use Time::Local(); use Spreadsheet::WriteExcel(); @@ -50,23 +51,17 @@ my @SubmitButtons = ({ name => 'PrevProb { name => 'NextProblemAnalysis', text => 'Next Problem' }, { name => 'break'}, - { name => 'ClearCache', - text => 'Clear Caches' }, - { name => 'updatecaches', - text => 'Update Student Data' }, { name => 'SelectAnother', text => 'Choose a different Problem' }, { name => 'ExcelOutput', text => 'Produce Excel Output' }); - sub BuildProblemAnalysisPage { my ($r,$c)=@_; # my %Saveable_Parameters = ('Status' => 'scalar', 'Section' => 'array', 'NumPlots' => 'scalar', - 'AnalyzeAs' => 'scalar', 'AnalyzeOver' => 'scalar', ); &Apache::loncommon::store_course_settings('problem_analysis', @@ -76,29 +71,22 @@ sub BuildProblemAnalysisPage { # &Apache::lonstatistics::PrepareClasslist(); # - $r->print('
'. + ''.$title.' (N='.$N.')'. + ''. + ' | ||
'.$min.' | '. + ''.$plotresult.' | '. + ''.$max.' | '. + '
'. + 'Maximum Number of Coinciding Values: '.$max_y. + ' |
'. + ''. + &mt($pre_graph_text, + $plot_num,$foil_choice_data->{'_count'}, + $correct, + $foil_choice_data->{'_count'}-$correct, + @extra_data). + ' | ||||
'.$concept_plot.' | '. + ''.$choice_plot.' | '; + if ($stacked_plot ne '') { + $analysis_html .= + ''.$stacked_plot.' | '. + ''.&build_foil_key($foils,$count_by_foil).' | '; } else { - if ($ProblemData->{'_Foils'}->{$foilid}->{'value'} eq 'true') { - push (@PlotData_Correct, - int(100*$DataSet{$foilid}/$total)); - push (@PlotData_Incorrect,0); + $analysis_html .= (''x2); + } + $analysis_html.=' |
'. + $post_graph_text.' | ||||
'.
+ &mt($no_data_text,
+ $plot_num,$foil_choice_data->{'_count'},
+ $correct,
+ $foil_choice_data->{'_count'}-$correct,
+ @extra_data);
+ if (defined($post_graph_text)) {
+ $analysis_html.=' '.$post_graph_text; + } + $analysis_html.=' |
'. + &mt('None of the selected students attempted the problem more than [_1] times.',$try-1). + ' | |||
'. + &mt('None of the selected students have attempted the problem').' | |||
'.$correctgraph.' | '; - ## - ## - next if (! defined($Datasets[0])); - for (my $i=0; $i< scalar(@{$Datasets[0]});$i++) { - $Datasets[0]->[$i]=0; + next if (! exists($foil_plot[$try]->{$option})); + push(@Datasets,$foil_plot[$try]->{$option}); } - $count = $ResponseData{'_total'}->[$i]-$ResponseData{'_correct'}->[$i]; - if ($count == 0) { - $count = 'no submissions'; - } elsif ($count == 1) { - $count = '1 submission'; - } else { - $count = $count.' submissions'; + # + # Put a blank in the data set between concepts + for (my $set =0;$set<=$#Datasets;$set++) { + my @Data = @{$Datasets[$set]}; + my $idx = 0; + foreach my $concept (@{$Concepts}) { + foreach my $foilid (@{$concept->{'foils'}}) { + $Datasets[$set]->[$idx++]=shift(@Data); + } + if ($concept->{'name'} ne $Concepts->[-1]->{'name'}) { + $Datasets[$set]->[$idx++] = 0; + } + } } - $title = 'Attempt '.$i.', '.$count; - my $incorrectgraph = &Apache::loncommon::DrawBarGraph - ($title,'Foil Number','% Option Chosen Incorrectly', - 100,$plotcolors,@Datasets); - $analysis_html.= ''.$incorrectgraph.' | '; - $analysis_html.= ''.$foilkey." |
'.$graphlink." | ||||
'. + ''. + &mt('Attempt [_1], [_2] submissions, [_3] correct, [_4] incorrect', + $try,$data_count,$correct,$data_count-$correct). + ''.' | ||||
'.$concept_graph.' | '. + ''.$correct_graph.' | '. + ''.$incorrect_graph.' | '. + ''.$optionkey.' | '. + ' |
'. + &mt('Data from [_1] to [_2]', + &Apache::lonlocal::locallocaltime($starttime), + &Apache::lonlocal::locallocaltime($endtime)). + ' | |||
'. + &mt('[_1] submissions from [_2] students submitting, [_3] correct, [_4] incorrect', + $data_count,$student_count,$correct,$data_count-$correct). + ' | |||
'.$concept_correct_plot.' | '. + ''.$foil_correct_plot.' | '. + ''.$foil_incorrect_plot.' | '. + ''.$foilkey.' |
'.
+ &mt('Start time: [_1]',$startdateform).' '. + &mt('End time: [_1]',$enddateform).' | |||
  |
'. + ''.('*'x4).' | '. + ''.&HTML::Entities::encode($foil,'<>&"'). + (' 'x2).$extra_data->{$foil}.' | '. + "
'.&mt('Sections').' | '; @@ -1422,60 +1643,55 @@ sub CreateInterface { ## ## $Str .= '';
- { # These braces are here to organize the code, not scope it.
- {
- $Str .= ' '; - } - { - $Str .= ' '; - } - { - $Str .= ' '; + ## + my $analyze_selector = ''; + $Str .= ' '.$/; + ## + my $numplots_selector = ' '; + $Str .= ' | ';
##
##
@@ -1510,8 +1726,9 @@ sub get_tries_from_row {
sub hashify_attempt {
my ($row) = @_;
my %attempt;
+ $attempt{'student'} = $row->[&Apache::loncoursedata::RD_sname()];
$attempt{'tries'} = $row->[&Apache::loncoursedata::RD_tries()];
- $attempt{'submission'} = $row->[&Apache::loncoursedata::RD_submission()];
+ $attempt{'submission'} = &Apache::lonnet::unescape($row->[&Apache::loncoursedata::RD_submission()]);
$attempt{'award'} = $row->[&Apache::loncoursedata::RD_awarddetail()];
$attempt{'timestamp'} = $row->[&Apache::loncoursedata::RD_timestamp()];
return %attempt;
@@ -1520,14 +1737,14 @@ sub hashify_attempt {
sub Process_OR_Row {
my ($row) = @_;
my %RowData;
- my $student_id = $row->[&Apache::loncoursedata::RD_student_id()];
+# my $student_id = $row->[&Apache::loncoursedata::RD_student_id()];
my $award = $row->[&Apache::loncoursedata::RD_awarddetail()];
my $grading = $row->[&Apache::loncoursedata::RD_response_eval()];
my $submission = $row->[&Apache::loncoursedata::RD_submission()];
my $time = $row->[&Apache::loncoursedata::RD_timestamp()];
- my $tries = $row->[&Apache::loncoursedata::RD_tries()];
+# my $tries = $row->[&Apache::loncoursedata::RD_tries()];
return undef if ($award eq 'MISSING_ANSWER');
- if ($award =~ /(APPROX_ANS|EXACT_ANS)/) {
+ if (&submission_is_correct($award)) {
$RowData{'_correct'} = 1;
}
$RowData{'_total'} = 1;
@@ -1548,58 +1765,15 @@ sub Process_OR_Row {
return %RowData;
}
-##
-## get problem data and put it into a useful data structure.
-## note: we must force each foil and option to not begin or end with
-## spaces as they are stored without such data.
-##
-sub get_problem_data {
- my ($url) = @_;
- my $Answ=&Apache::lonnet::ssi($url,('grade_target' => 'analyze'));
- (my $garbage,$Answ)=split(/_HASH_REF__/,$Answ,2);
- my %Answer;
- %Answer=&Apache::lonnet::str2hash($Answ);
- my %Partdata;
- foreach my $part (@{$Answer{'parts'}}) {
- while (my($key,$value) = each(%Answer)) {
- next if ($key !~ /^$part/);
- $key =~ s/^$part\.//;
- if (ref($value) eq 'ARRAY') {
- if ($key eq 'options') {
- $Partdata{$part}->{'_Options'}=$value;
- } elsif ($key eq 'concepts') {
- $Partdata{$part}->{'_Concepts'}=$value;
- } elsif ($key =~ /^concept\.(.*)$/) {
- my $concept = $1;
- foreach my $foil (@$value) {
- $Partdata{$part}->{'_Foils'}->{$foil}->{'_Concept'}=
- $concept;
- }
- }
- } else {
- if ($key=~ /^foil\.text\.(.*)$/) {
- my $foil = $1;
- $Partdata{$part}->{'_Foils'}->{$foil}->{'name'}=$foil;
- $value =~ s/(\s*$|^\s*)//g;
- $Partdata{$part}->{'_Foils'}->{$foil}->{'text'}=$value;
- } elsif ($key =~ /^foil\.value\.(.*)$/) {
- my $foil = $1;
- $Partdata{$part}->{'_Foils'}->{$foil}->{'value'}=$value;
- }
- }
- }
+sub submission_is_correct {
+ my ($award) = @_;
+ if ($award =~ /(APPROX_ANS|EXACT_ANS)/) {
+ return 1;
+ } else {
+ return 0;
}
- return %Partdata;
}
1;
__END__
-
-#####
-# partdata{part}->{_Foils}->{foilid}->{'name'} = $
-# ->{'text'} = $
-# ->{'value'} = $
-# ->{'_Concept'} = $
-# partdata{part}->{_Options} = @
-# partdata{part}->{_Concepts} = @