--- loncom/homework/grades.pm 2007/06/15 22:16:13 1.409 +++ loncom/homework/grades.pm 2007/06/16 01:37:44 1.410 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.409 2007/06/15 22:16:13 albertel Exp $ +# $Id: grades.pm,v 1.410 2007/06/16 01:37:44 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -6313,6 +6313,20 @@ sub process_clicker_file { ''.&HTML::Entities::encode($env{'form.upfile.filename'},'<>&"').''); return $result.&show_grading_menu_form($symb); } + +# Were able to get all the info needed, now analyze the file + + my $heading=&mt('Scanning clicker file'); + $result.=(<
+
+$heading
+
+ + + + +ENDHEADER my %responses; my @questiontitles; my $errormsg=''; @@ -6320,10 +6334,21 @@ sub process_clicker_file { if ($env{'form.upfiletype'} eq 'iclicker') { ($errormsg,$number)=&iclicker_eval(\@questiontitles,\%responses); } - $result.='
'.&mt('Found [_1] questions',$number).'
'; + $result.='
'.&mt('Found [_1] question(s)',$number).'
'; + my $found_correct_flag=0; foreach my $id (keys(%responses)) { - $result.='
'.$id.' - '.$responses{$id}; + if ($correct_ids{$id}) { + $result.="\n".''; + $found_correct_flag++; + } elsif ($clicker_ids{$id}) { + $result.="\n".''; + } else { + $result.="\n
Unknown: ".$id." - ".$responses{$id}; + } } + $result.='
'; + $result.='
'."\n". + '


'."\n"; return $result.&show_grading_menu_form($symb); } @@ -6332,14 +6357,8 @@ sub iclicker_eval { my $number=0; my $errormsg=''; foreach my $line (split(/[\n\r]/,$env{'form.upfile'})) { - chomp($line); - foreach my $quoted ($line=~/\,\s*\"([^\"]*)\"\s*\,/g) { - my $replace=$quoted; - $replace=~s/\,//g; - &Apache::lonnet::logthis($quoted.' - '.$replace.'
'); - $line=~s/\,\s*\"\Q$quoted\E\"\s*\,/,$replace,/gs; - } - my @entries=split(/\,/,$line); + my %components=&Apache::loncommon::record_sep($line); + my @entries=map {$components{$_}} (sort(keys(%components))); if ($entries[0] eq 'Question') { for (my $i=3;$i<$#entries;$i+=6) { $$questiontitles[$number]=$entries[$i];