[LON-CAPA-cvs] cvs: loncom /interface default.assesscalc

matthew lon-capa-cvs@mail.lon-capa.org
Fri, 13 Dec 2002 16:36:34 -0000


matthew		Fri Dec 13 11:36:34 2002 EDT

  Modified files:              
    /loncom/interface	default.assesscalc 
  Log:
  Use multiline format to reduce the number of ternary operators.
  Handle excused status - if stores_0_solved is 'excused, the available
  points and awarded points fields are set to 0.
  This should be a part of version 0.6
  
  
Index: loncom/interface/default.assesscalc
diff -u loncom/interface/default.assesscalc:1.5 loncom/interface/default.assesscalc:1.6
--- loncom/interface/default.assesscalc:1.5	Tue Oct 16 18:57:07 2001
+++ loncom/interface/default.assesscalc	Fri Dec 13 11:36:34 2002
@@ -1,15 +1,74 @@
-<field col=A row=0>(I0?(K0?(K0==I0?'correct':K0.'/'.I0.' correct'):'incorrect'):'')</field>
+<field col=A row=0>
+if ([stores_0_solved] eq 'excused') {
+    'excused';
+} elsif (M0) { 
+    if(K0) {
+        if (K0 == M0) {
+            "correct";
+        } else {
+            K0.'/'.M0.' correct';
+        }
+    } else {
+        "incorrect";
+    }
+} else {
+    '';
+}
+</field>
+
 <field col=B row=0>'Tries:'</field>
-<field col=C row=0>(I0?[&EXPANDSUM(PART;stores_PART_tries)]/I0:'')</field>
+<field col=C row=0>
+if (M0) {
+    [&EXPANDSUM(PART;stores_PART_tries)]/M0;
+} else {
+    '';
+}
+</field>
+
 <field col=D row=0>'Timestamp:'</field>
 <field col=E row=0>[timestamp]</field>
-<field col=F row=0>'Duedate:'</field>
-<field col=G row=0>[parameter_0_duedate]</field>
-<field col=H row=0>'Attempted Parts:'</field>
-<field col=I row=0>[&EXPANDSUM(PART;(stores_PART_solved?1:0))]</field>
-<field col=J row=0>'Solved Parts:'</field>
-<field col=K row=0>[&EXPANDSUM(PART;(stores_PART_awarded?1:0))]</field>
+<field col=F row=0>
+if ([timestamp]>100000000) { 
+    $tmp = localtime([timestamp]); 
+    $tmp =~ s/\s/&nbsp;/g;
+    $tmp;
+} else {
+    '';
+}
+</field>
+
+<field col=G row=0>'Duedate:'</field>
+<field col=H row=0>[parameter_0_duedate]</field>
+<field col=I row=0>
+if ([parameter_0_duedate]>100000000) { 
+    $tmp = localtime([parameter_0_duedate]); 
+    $tmp =~ s/\s/&nbsp;/g;
+    $tmp;
+} else {
+    '';
+}
+</field>
+
+<field col=J row=0>'Attempted Parts:'</field>
+<field col=K row=0>[&EXPANDSUM(PART;(stores_PART_solved?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>[&EXPANDSUM(PART;parameter_PART_weight)]</field>
+<field col=X row=0>
+if (([stores_0_solved]) eq 'excused') { 
+    0 
+} else { 
+    [&EXPANDSUM(PART;parameter_PART_weight)];
+}
+</field>
+
 <field col=Y row=0>'Awarded Points:'</field>
-<field col=Z row=0>[&EXPANDSUM(PART;parameter_PART_weight*stores_PART_awarded)]</field>
+<field col=Z row=0>
+if (([stores_0_solved]) eq 'excused') { 
+    0 
+} else { 
+    [&EXPANDSUM(PART;parameter_PART_weight*stores_PART_awarded)]
+}
+</field>