[LON-CAPA-cvs] cvs: loncom /interface lonstatistics.pm

minaeibi lon-capa-cvs@mail.lon-capa.org
Mon, 13 May 2002 15:01:54 -0000


minaeibi		Mon May 13 11:01:54 2002 EDT

  Modified files:              
    /loncom/interface	lonstatistics.pm 
  Log:
  Revised a little bug in feeding the correct part to EXT for open and due dates.
  
  
Index: loncom/interface/lonstatistics.pm
diff -u loncom/interface/lonstatistics.pm:1.15 loncom/interface/lonstatistics.pm:1.16
--- loncom/interface/lonstatistics.pm:1.15	Mon May 13 09:50:45 2002
+++ loncom/interface/lonstatistics.pm	Mon May 13 11:01:54 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # (Publication Handler
 #
-# $Id: lonstatistics.pm,v 1.15 2002/05/13 13:50:45 minaeibi Exp $
+# $Id: lonstatistics.pm,v 1.16 2002/05/13 15:01:54 minaeibi Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -135,13 +135,13 @@
 
 
 sub Interval {
-    my $symb=shift;
+    my ($rid,$part,$symb)=@_;
     my $Int=$ConceptData{"Interval"};
-    my $due = &Apache::lonnet::EXT('resource.0.duedate',$symb)+1;
-    my $opn = &Apache::lonnet::EXT('resource.0.opendate',$symb);
+    my $due = &Apache::lonnet::EXT('resource.$part.duedate',$symb)+1;
+    my $opn = &Apache::lonnet::EXT('resource.$part.opendate',$symb);
     my $add=int(($due-$opn)/$Int);
-#    $r->print("<br> $opn, to $due add=$add  int=$Int");
-    #$r->rflush();
+#$r->print("<br> $opn, to $due add=$add  int=$Int");
+#$r->rflush();
     $ConceptData{"Int.0"}=$opn;
     for (my $i=1;$i<$Int;$i++) {
 	$ConceptData{"Int.$i"}=$opn+$i*$add;
@@ -176,11 +176,10 @@
     </script>
 ENDPOP
 
-    &Create_PrgWin();
-    &Update_PrgWin("Starting to analyze problem");
-    my $rid=substr($InpStr,8);
+    my ($rid,$part)=split(/\:/,substr($InpStr,8));
     $ConceptData{"Interval"}=$Int_No;
-    &Interval(&InitAnalysis($rid,$students[0]));
+    my $symb=&InitAnalysis($rid,$students[0]);
+    &Interval($rid,$part,$symb);
     my $URI = $hash{'src_'.$rid};
     my $Src = $hash{'title_'.$rid};
     $Src =~ s/\ /"_"/eg;
@@ -190,9 +189,10 @@
 	$tmp =~ s/</" less than "/eg;
 	$r->print("<br><b>Concept $n</b>:$tmp");
     }
-    
     $r->rflush();
     
+    &Create_PrgWin();
+    &Update_PrgWin("Starting to analyze problem");
     for (my $index=0;$index<=$#students;$index++) {
 	&Update_PrgWin($index);
 	&OpStatus($rid,$students[$index]);
@@ -264,6 +264,7 @@
 #	$Max = int($Max);
 #   }
 #   else { $Max = 1; }
+
     my $Titr=($ConceptData{'Interval'}>1) ? $Src.'_interval_'.$k : $Src;
     $GData=$Titr.'&'.'Answers'.'&'.$Max.'&'.$P_No.'&'.$data1.'&'.$data2;
     if($ConceptData{'Interval'}>1){
@@ -319,13 +320,14 @@
 
      my $P_No=1;
      foreach (sort keys %OpResp) {
-	 my $Temp = '<a href="'.$hash{'src_'.$OpResp{$_}}.
-                    '" target="_blank">'.$hash{'title_'.$OpResp{$_}}.'</a>';
+	 my ($rid,$part)=split(/\:/,$OpResp{$_});
+	 my $Temp = '<a href="'.$hash{'src_'.$rid}.
+                    '" target="_blank">'.$hash{'title_'.$rid}.'</a>';
 	 $Str .= "\n"."<tr>".
 	         "\n"."<td> $P_No </td>".
                  "\n"."<td bgcolor=#DDFFDD> ".$Temp." </td>".
-                 "\n"."<td bgcolor=#EEFFCC> ".$hash{'src_'.$OpResp{$_}}." </td>".
-	         "\n"."<td> ".'<input type="submit" name="sort" value="'.'Analyze_'.$OpResp{$_}.'" />'.'</td>'.
+                 "\n"."<td bgcolor=#EEFFCC> ".$hash{'src_'.$rid}." </td>".
+	         "\n"."<td> ".'<input type="submit" name="sort" value="'.'Analyze_'.$rid.'" />'.'</td>'.
                  "\n"."</tr>";
 	 $P_No++;
      }
@@ -944,9 +946,8 @@
 			   foreach my $K(split(/\,/,&Apache::lonnet::metadata($meta,'packages'))) {
 			       if ($K=~/^optionresponse\_($Part)\_(\w+)$/) {
 				   #$r->print('<br>'.$_.'...'.$P_Order.'---'.$Part);
-				   $OpResp{$P_Order}=$frid;
+				   $OpResp{$P_Order}="$frid:$Part";
 			       } 
-		   
 			   }
 		       }
 		   }
@@ -968,7 +969,7 @@
 			   foreach (split(/\,/,&Apache::lonnet::metadata($meta,'packages'))) {
 			       if ($_=~/^optionresponse\_($Part)\_(\w+)$/) {
 				   #$r->print('<br>'.$_.'...'.$P_Order.'---'.$Part);
-				   $OpResp{$P_Order}=$rid;
+				   $OpResp{$P_Order}="$rid:$Part";;
 			       } 
 		   
 			   }