[LON-CAPA-cvs] cvs: loncom /homework lonsimpleproblemedit.pm

truskell truskell@source.lon-capa.org
Thu, 24 Sep 2009 00:50:03 -0000


truskell		Thu Sep 24 00:50:03 2009 EDT

  Modified files:              
    /loncom/homework	lonsimpleproblemedit.pm 
  Log:
  The weight of unused, hidden parts should be zero for "Simple Problems".
  
  
Index: loncom/homework/lonsimpleproblemedit.pm
diff -u loncom/homework/lonsimpleproblemedit.pm:1.25 loncom/homework/lonsimpleproblemedit.pm:1.26
--- loncom/homework/lonsimpleproblemedit.pm:1.25	Mon Aug 17 19:46:49 2009
+++ loncom/homework/lonsimpleproblemedit.pm	Thu Sep 24 00:50:03 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Simple Problem Parameter Setting "Editor"
 #
-# $Id: lonsimpleproblemedit.pm,v 1.25 2009/08/17 19:46:49 www Exp $
+# $Id: lonsimpleproblemedit.pm,v 1.26 2009/09/24 00:50:03 truskell Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -40,6 +40,7 @@
 
 my %qparms;
 my $prefix;
+my $weightprefix;
 my $qtype;
 
 sub evaloptionhash {
@@ -191,6 +192,9 @@
 
 # ------------------------------------------------ Prefix for everything stored
     $prefix=$env{'request.course.id'}.'.'.$symb.'.0.';
+#------------------------------------------------- Prefix for storing weight of Problem Parts
+    $weightprefix=$env{'request.course.id'}.'.'.$symb.'.';
+    
 # ---------------------------------------------------------- Anything to store?
 
     if (($symb) && (defined($env{'form.questiontype'}))) {
@@ -216,11 +220,21 @@
 		$storecontent{$prefix.$parm}=~s/\s+$//s;
 	    }
 	}
+# ---------------------------------------------------- Set weights of hidden parts to zero
+# ------------------------------------------------------ and used part to 1
+	$storecontent{$weightprefix.'essay.weight'}=0;
+	$storecontent{$weightprefix.'numerical.weight'}=0;
+	$storecontent{$weightprefix.'option.weight'}=0;
+	$storecontent{$weightprefix.'radio.weight'}=0;
+	$storecontent{$weightprefix.'string.weight'}=0;
+	$storecontent{$weightprefix.$env{'form.questiontype'}.'.weight'}=1;
+
+
 	my $reply=&Apache::lonnet::cput
 	    ('resourcedata',\%storecontent,
 	     $env{'course.'.$env{'request.course.id'}.'.domain'},
 	     $env{'course.'.$env{'request.course.id'}.'.num'});
-        
+
         &Apache::lonnet::devalidatecourseresdata(
                             $env{'course.'.$env{'request.course.id'}.'.num'},
                             $env{'course.'.$env{'request.course.id'}.'.domain'});