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

matthew lon-capa-cvs@mail.lon-capa.org
Mon, 09 Sep 2002 17:18:34 -0000


matthew		Mon Sep  9 13:18:34 2002 EDT

  Modified files:              
    /loncom/interface	lonspreadsheet.pm 
  Log:
  Added $sheetdata goodness to &updateclasssheet and &updatestudentassesssheet.
  Fixed a caching bug which caused caching to only happen on a sheet basis, not
  a student basis.  Thus the instructor could only see one students assessment
  sheets, regardless of which student she wanted to see.
  
  
Index: loncom/interface/lonspreadsheet.pm
diff -u loncom/interface/lonspreadsheet.pm:1.107 loncom/interface/lonspreadsheet.pm:1.108
--- loncom/interface/lonspreadsheet.pm:1.107	Thu Sep  5 10:38:57 2002
+++ loncom/interface/lonspreadsheet.pm	Mon Sep  9 13:18:33 2002
@@ -1,5 +1,5 @@
 #
-# $Id: lonspreadsheet.pm,v 1.107 2002/09/05 14:38:57 matthew Exp $
+# $Id: lonspreadsheet.pm,v 1.108 2002/09/09 17:18:33 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1680,11 +1680,11 @@
 
 # ---------------------------------------------- Update rows for course listing
 sub updateclasssheet {
-    my $safeeval=shift;
-    my $cnum=&getcnum($safeeval);
-    my $cdom=&getcdom($safeeval);
-    my $cid=&getcid($safeeval);
-    my $chome=&getchome($safeeval);
+    my ($safeeval,$sheetdata) = @_;
+    my $cnum  =$sheetdata->{'cnum'};
+    my $cdom  =$sheetdata->{'cdom'};
+    my $cid   =$sheetdata->{'cid'};
+    my $chome =$sheetdata->{'chome'};
     #
     # Read class list and row labels
     my %classlist;
@@ -1784,13 +1784,17 @@
 
 # ----------------------------------- Update rows for student and assess sheets
 sub updatestudentassesssheet {
-    my $safeeval=shift;
+    my ($safeeval,$sheetdata) = @_;
     my %bighash;
-    my $stype=&gettype($safeeval);
+    my $stype=$sheetdata->{'sheettype'};
+    my $uname=$sheetdata->{'uname'};
+    my $udom =$sheetdata->{'udom'};
     my %current=();
-    if  ($updatedata{$ENV{'request.course.fn'}.'_'.$stype}) {
+    if  ($updatedata
+         {$ENV{'request.course.fn'}.'_'.$stype.'_'.$uname.'_'.$udom}) {
         %current=split(/\_\_\_\;\_\_\_/,
-		       $updatedata{$ENV{'request.course.fn'}.'_'.$stype});
+                       $updatedata{$ENV{'request.course.fn'}.
+                                       '_'.$stype.'_'.$uname.'_'.$udom});
     } else {
         # Tie hash
         tie(%bighash,'GDBM_File',$ENV{'request.course.fn'}.'.db',
@@ -1808,10 +1812,8 @@
                      'totalpoints' =>
                      'Total Points Granted<br>totalpoints');
         my $adduserstr='';
-        if ((&getuname($safeeval) ne $ENV{'user.name'}) ||
-            (&getudom($safeeval) ne $ENV{'user.domain'})) {
-            $adduserstr='&uname='.&getuname($safeeval).
-                '&udom='.&getudom($safeeval);
+        if (($uname ne $ENV{'user.name'}) || ($udom ne $ENV{'user.domain'})){
+            $adduserstr='&uname='.$uname.'&udom='.$udom;
         }
         my %allassess =
             ('_feedback' =>'<a href="/adm/assesscalc?usymb=_feedback'.
@@ -1862,7 +1864,7 @@
         } elsif ($stype eq 'studentcalc') {
             %current=%allassess;
         }
-        $updatedata{$ENV{'request.course.fn'}.'_'.$stype}=
+        $updatedata{$ENV{'request.course.fn'}.'_'.$stype.'_'.$uname.'_'.$udom}=
             join('___;___',%current);
         # Get current from cache
     }
@@ -2185,9 +2187,9 @@
     my ($safeeval,$sheetdata)=@_;
     my $stype=$sheetdata->{'sheettype'};
     if ($stype eq 'classcalc') {
-	return &updateclasssheet($safeeval);
+	return &updateclasssheet($safeeval,$sheetdata);
     } else {
-        return &updatestudentassesssheet($safeeval);
+        return &updatestudentassesssheet($safeeval,$sheetdata);
     }
 }