[LON-CAPA-cvs] cvs: loncom /interface/statistics lonproblemanalysis.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Thu, 04 Jan 2007 02:44:12 -0000
albertel Wed Jan 3 21:44:12 2007 EDT
Modified files:
/loncom/interface/statistics lonproblemanalysis.pm
Log:
- updating to work (simplely) with multiple correct answers
Index: loncom/interface/statistics/lonproblemanalysis.pm
diff -u loncom/interface/statistics/lonproblemanalysis.pm:1.129 loncom/interface/statistics/lonproblemanalysis.pm:1.130
--- loncom/interface/statistics/lonproblemanalysis.pm:1.129 Thu Dec 21 14:52:28 2006
+++ loncom/interface/statistics/lonproblemanalysis.pm Wed Jan 3 21:44:07 2007
@@ -1,6 +1,6 @@
# The LearningOnline Network with CAPA
#
-# $Id: lonproblemanalysis.pm,v 1.129 2006/12/21 19:52:28 albertel Exp $
+# $Id: lonproblemanalysis.pm,v 1.130 2007/01/04 02:44:07 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -636,11 +636,21 @@
$sdom);
# make the key
my $key = $partid.'.'.$respid;
+ # pick one of the possible answers
+ my $which = 'INTERNAL';
+ if (!exists($analysis->{$key}{$which})) {
+ $which = (sort(keys(%{ $analysis->{$key} })))[0];
+ }
foreach my $item ('answer','unit','ans_high','ans_low') {
- $correct->{$sname.':'.$sdom}->{$item} =
- $analysis->{$key.'.'.$item}->[0];
+ if (ref($analysis->{$key.'.'.$item}) eq 'ARRAY') {
+ $correct->{$sname.':'.$sdom}->{$item} =
+ $analysis->{$key.'.'.$item}[0];
+ } else {
+ $correct->{$sname.':'.$sdom}->{$item} =
+ $analysis->{$key.'.'.$item}{$which}[0][0];
+ }
}
- $answers{$analysis->{$key.'.answer'}->[0]}++;
+ $answers{$correct->{$sname.':'.$sdom}{'answer'}}++;
&Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,
&mt('last student'));
}