[LON-CAPA-cvs] cvs: loncom /homework lonhomework.pm structuretags.pm /html/adm/help/tex Analyze_Problem.tex doc/loncapafiles loncapafiles.lpml

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 19 May 2003 21:05:24 -0000


albertel		Mon May 19 17:05:24 2003 EDT

  Added files:                 
    /loncom/html/adm/help/tex	Analyze_Problem.tex 

  Modified files:              
    /doc/loncapafiles	loncapafiles.lpml 
    /loncom/homework	lonhomework.pm structuretags.pm 
  Log:
  - Fixes all aspects of BUG#1418
  
  - improved onscreen interface to Analye problem
  - added simple help file abotu analyze problems
  - now summarizes frquencies of answers
  - prints message if no analyzable parts are found
  
  
Index: doc/loncapafiles/loncapafiles.lpml
diff -u doc/loncapafiles/loncapafiles.lpml:1.244 doc/loncapafiles/loncapafiles.lpml:1.245
--- doc/loncapafiles/loncapafiles.lpml:1.244	Fri May 16 16:56:38 2003
+++ doc/loncapafiles/loncapafiles.lpml	Mon May 19 17:05:23 2003
@@ -2,7 +2,7 @@
  "http://lpml.sourceforge.net/DTD/lpml.dtd">
 <!-- loncapafiles.lpml -->
 
-<!-- $Id: loncapafiles.lpml,v 1.244 2003/05/16 20:56:38 matthew Exp $ -->
+<!-- $Id: loncapafiles.lpml,v 1.245 2003/05/19 21:05:23 albertel Exp $ -->
 
 <!--
 
@@ -1868,6 +1868,7 @@
 About_Authors_Manual.tex;
 About_Numerical_and_Formula_Response.tex;
 Ambiguous_Reference.tex;
+Analyze_problem.tex;
 Author_LON-CAPA_Introduction.tex;
 Author_Manual_Title_Page.tex;
 Author_Numerical_and_Formula.tex;
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.129 loncom/homework/lonhomework.pm:1.130
--- loncom/homework/lonhomework.pm:1.129	Fri May 16 15:01:27 2003
+++ loncom/homework/lonhomework.pm	Mon May 19 17:05:23 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Homework handler
 #
-# $Id: lonhomework.pm,v 1.129 2003/05/16 19:01:27 albertel Exp $
+# $Id: lonhomework.pm,v 1.130 2003/05/19 21:05:23 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -398,7 +398,7 @@
 						 'last problem');
 	my $subresult=&Apache::lonnet::ssi($request->uri,
 					   ('grade_target' => 'analyze'),
-					   ('rndseed' => $i));
+					   ('rndseed' => $i+$rndseed));
 	&Apache::lonxml::debug(":$subresult:");
 	(my $garbage,$subresult)=split(/_HASH_REF__/,$subresult,2);
 	my %analyze=&Apache::lonnet::str2hash($subresult);
@@ -421,16 +421,27 @@
     foreach my $part (keys(%allparts)) {
 	if (defined(@{ $overall{$part.'.answer'} })) {
 	    $request->print('<table><tr><td>Part '.$part.'</td></tr>');
+	    my %frequency;
 	    foreach my $answer (sort {$a->[0] <=> $b->[0]} (@{ $overall{$part.'.answer'} })) {
-		$request->print('<tr><td>'.join('</td><td>',@{ $answer }).
-				'</td></tr>');
+		$frequency{join('\0',@{ $answer })}++;
+	    }
+	    foreach my $answer (sort {(split('\0',$a))[0] <=> (split('\0',$b))[0]} (keys(%frequency))) {
+		$request->print('<tr><td>'.
+				join('</td><td>',split('\0',$answer)).
+				'</td><td>('.$frequency{$answer}.
+				')</td></tr>');
 	    }
 	    $request->print('</table>');
 	} else {
 	    $request->print('<p>Part '.$part.
-			    ' is not analyzabale at this time</p>');
+			    ' is not analyzable at this time</p>');
 	}
     }
+    if (scalar(keys(%allparts)) == 0 ) {
+	$request->print('<p>Found no analyzable parts in this problem,
+                         currently only Numerical, Formula and String response
+                         styles are supported.</p>');
+    }
     &Apache::lonhtmlcommon::Close_PrgWin($request,\%prog_state);
     &analyze_footer($request);
     &Apache::lonhomework::showhash(%overall);
@@ -663,7 +674,7 @@
 	&renderpage($request,$file);
       } elsif ($ENV{'form.problemmode'} eq 'EditXML') {
 	&editxmlmode($request,$file);
-      } elsif ($ENV{'form.problemmode'} eq 'Answer Distribution') {
+      } elsif ($ENV{'form.problemmode'} eq 'Calculate answers') {
 	&analyze($request,$file);
       } else {
 	&renderpage($request,$file);
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.175 loncom/homework/structuretags.pm:1.176
--- loncom/homework/structuretags.pm:1.175	Thu May 15 17:44:23 2003
+++ loncom/homework/structuretags.pm	Mon May 19 17:05:23 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.175 2003/05/15 21:44:23 albertel Exp $
+# $Id: structuretags.pm,v 1.176 2003/05/19 21:05:23 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -193,10 +193,13 @@
     $result.= ' />&nbsp;Show&nbsp;All&nbsp;Foils
              <hr />';
     my $numtoanalyze=$ENV{'form.numtoanalyze'};
-    if (!$numtoanalyze) { $numtoanalyze=100; }
-    $result.= '<input type="submit" name="problemmode" value="Answer Distribution" />
+    if (!$numtoanalyze) { $numtoanalyze=20; }
+    $result.= '<input type="submit" name="problemmode" value="Calculate answers" /> for
              <input type="text" name="numtoanalyze" value="'.
-		 $numtoanalyze.'" size="5" /> <hr />';
+		 $numtoanalyze.'" size="5" /> versions of this problem.'.
+		     &Apache::loncommon::help_open_topic("Analyze_Problem",
+						     '',undef,undef,300).
+		     '<hr />';
     return $result;
 }
 

Index: loncom/html/adm/help/tex/Analyze_Problem.tex
+++ loncom/html/adm/help/tex/Analyze_Problem.tex
\label{Analyze_Problem}

%

This will calculate and display the answers of N randomly selected
versions of the problem and then list them. If N is large, this may
take a while. This curretnly only works for Numeric, Formula and
String problem types.