[LON-CAPA-cvs] cvs: loncom /interface/spreadsheet Spreadsheet.pm default_assesscalc

matthew lon-capa-cvs@mail.lon-capa.org
Fri, 01 Aug 2003 13:47:26 -0000


matthew		Fri Aug  1 09:47:26 2003 EDT

  Modified files:              
    /loncom/interface/spreadsheet	Spreadsheet.pm default_assesscalc 
  Log:
  Bug 840, default spreadsheet should show proper available points on
  excused and partially excused problems.
  
  
Index: loncom/interface/spreadsheet/Spreadsheet.pm
diff -u loncom/interface/spreadsheet/Spreadsheet.pm:1.19 loncom/interface/spreadsheet/Spreadsheet.pm:1.20
--- loncom/interface/spreadsheet/Spreadsheet.pm:1.19	Wed Jul 16 12:48:51 2003
+++ loncom/interface/spreadsheet/Spreadsheet.pm	Fri Aug  1 09:47:26 2003
@@ -1,5 +1,5 @@
 #
-# $Id: Spreadsheet.pm,v 1.19 2003/07/16 16:48:51 matthew Exp $
+# $Id: Spreadsheet.pm,v 1.20 2003/08/01 13:47:26 matthew Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -794,8 +794,8 @@
 	my @vars=split(/\W+/,$formula);
         my %values=();
 	foreach my $varname ( @vars ) {
-            if ($varname=~/\D/) {
-               $formula=~s/$varname/'$c{\''.$varname.'\'}'/ge;
+            if ($varname=~/^(parameter|stores|timestamp)/) {
+                $formula=~s/$varname/'$c{\''.$varname.'\'}'/ge;
                $varname=~s/$var/\([\\w:\\- ]\+\)/g;
 	       foreach (keys(%{$self->{'constants'}})) {
 		  if ($_=~/$varname/) {
Index: loncom/interface/spreadsheet/default_assesscalc
diff -u loncom/interface/spreadsheet/default_assesscalc:1.6 loncom/interface/spreadsheet/default_assesscalc:1.7
--- loncom/interface/spreadsheet/default_assesscalc:1.6	Fri Dec 13 11:36:34 2002
+++ loncom/interface/spreadsheet/default_assesscalc	Fri Aug  1 09:47:26 2003
@@ -1,12 +1,14 @@
 <field col=A row=0>
-if ([stores_0_solved] eq 'excused') {
+if ("[stores_0_solved]" eq 'excused') {
     'excused';
 } elsif (M0) { 
     if(K0) {
         if (K0 == M0) {
             "correct";
-        } else {
+        } elsif (K0 < M0) {
             K0.'/'.M0.' correct';
+        } else {
+            'correct';
         }
     } else {
         "incorrect";
@@ -50,23 +52,25 @@
 </field>
 
 <field col=J row=0>'Attempted Parts:'</field>
-<field col=K row=0>[&EXPANDSUM(PART;(stores_PART_solved?1:0))]</field>
+<field col=K row=0>
+[&EXPANDSUM(PART;(stores_PART_solved !~ /^(\W?excused\W?|)$/ ?1:0))]
+</field>
 
 <field col=L row=0>'Solved Parts:'</field>
 <field col=M row=0>[&EXPANDSUM(PART;(stores_PART_awarded?1:0))]</field>
 
 <field col=W row=0>'Available Points:'</field>
 <field col=X row=0>
-if (([stores_0_solved]) eq 'excused') { 
+if ("[stores_0_solved]" eq 'excused') {
     0 
 } else { 
-    [&EXPANDSUM(PART;parameter_PART_weight)];
+    [&EXPANDSUM(PART;parameter_PART_weight*(stores_PART_solved !~ /^\W?excused\W?$/ ? 1 : 0))];
 }
 </field>
 
 <field col=Y row=0>'Awarded Points:'</field>
 <field col=Z row=0>
-if (([stores_0_solved]) eq 'excused') { 
+if ("[stores_0_solved]" eq 'excused') { 
     0 
 } else { 
     [&EXPANDSUM(PART;parameter_PART_weight*stores_PART_awarded)]