[LON-CAPA-cvs] cvs: loncom /homework grades.pm /interface loncommon.pm

raeburn raeburn at source.lon-capa.org
Fri Nov 21 12:59:12 EST 2014


raeburn		Fri Nov 21 17:59:12 2014 EDT

  Modified files:              
    /loncom/interface	loncommon.pm 
    /loncom/homework	grades.pm 
  Log:
  - Bug 6740 Out-of-order recording of submissions (by time). 
   - "reset_status" event for a problem part subsequent to out-of-order 
     ("incorrect_attempted" post-"correct_by_student") eliminates
     need to provide "Hide" checkbox in grading menu for that particular
     transaction. 
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1199 loncom/interface/loncommon.pm:1.1200
--- loncom/interface/loncommon.pm:1.1199	Sat Nov  8 18:26:06 2014
+++ loncom/interface/loncommon.pm	Fri Nov 21 17:59:06 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.1199 2014/11/08 18:26:06 raeburn Exp $
+# $Id: loncommon.pm,v 1.1200 2014/11/21 17:59:06 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3837,7 +3837,8 @@
               }
           } elsif ($data eq 'regrader') {
               if (($identifier ne '') && (@parts)) {
-                  $regraded{$parts[-1]} = 1;
+                  my $id = join(',', at parts);
+                  $regraded{$ign.'.'.$id} = 1;
               }
           } 
 	} else {
@@ -3851,16 +3852,18 @@
       $prevattempts.=&end_data_table_header_row();
       if ($getattempt eq '') {
         my (%solved,%resets,%probstatus);
-	for ($version=1;$version<=$returnhash{'version'};$version++) {
-            if ($identifier ne '') {
-                foreach my $part (keys(%regraded)) {
-                    if (($returnhash{$version.':resource.'.$part.'.regrader'}) &&
-                        ($returnhash{$version.':resource.'.$part.'.tries'} eq '') &&
-                        ($returnhash{$version.':resource.'.$part.'.award'} eq '')) {
-                        push(@{$resets{$part}},$version);
+        if (($identifier ne '') && (keys(%regraded) > 0)) {
+            for ($version=1;$version<=$returnhash{'version'};$version++) {
+                foreach my $id (keys(%regraded)) {
+                    if (($returnhash{$version.':'.$id.'.regrader'}) &&
+                        ($returnhash{$version.':'.$id.'.tries'} eq '') &&
+                        ($returnhash{$version.':'.$id.'.award'} eq '')) {
+                        push(@{$resets{$id}},$version);
                     }
                 }
             }
+        }
+	for ($version=1;$version<=$returnhash{'version'};$version++) {
             my (@hidden, at unsolved);
             if (%typeparts) {
                 foreach my $id (keys(%typeparts)) {
@@ -3871,7 +3874,7 @@
                         unless (($returnhash{$version.':'.$id.'.type'} eq 'survey') ||
                                 ($returnhash{$version.':'.$id.'.type'} eq 'surveycred') ||
                                 ($hidestatus{$id})) {
-                            next if ((ref($resets{$id}) eq 'ARRAY') && grep(/^\Q$id\E$/,@{$resets{$id}}));
+                            next if ((ref($resets{$id}) eq 'ARRAY') && grep(/^\Q$version\E$/,@{$resets{$id}}));
                             if ($returnhash{$version.':'.$id.'.solved'} eq 'correct_by_student') {
                                 push(@{$solved{$id}},$version);
                             } elsif (($returnhash{$version.':'.$id.'.solved'} ne '') &&
@@ -15323,7 +15326,6 @@
     return %courses;
 }
 
-
 =pod
 
 =back
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.726 loncom/homework/grades.pm:1.727
--- loncom/homework/grades.pm:1.726	Sat Nov  8 18:26:01 2014
+++ loncom/homework/grades.pm	Fri Nov 21 17:59:11 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.726 2014/11/08 18:26:01 raeburn Exp $
+# $Id: grades.pm,v 1.727 2014/11/21 17:59:11 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3019,7 +3019,8 @@
     my %aggregate = ();
     my $aggregateflag = 0;
     if ($env{'form.HIDE'.$newflg}) {
-        my $numchgs = &makehidden($newflg,\%record,$symb,$domain,$stuname);
+        my ($version,$parts) = split(/:/,$env{'form.HIDE'.$newflg},2);
+        my $numchgs = &makehidden($version,$parts,\%record,$symb,$domain,$stuname);
         $totchg += $numchgs;
     }
     my @parts = split(/:/,$env{'form.partlist'.$newflg});
@@ -3128,11 +3129,10 @@
 }
 
 sub makehidden {
-    my ($newflg,$record,$symb,$domain,$stuname) = @_;
+    my ($version,$parts,$record,$symb,$domain,$stuname) = @_;
     return unless (ref($record) eq 'HASH');
     my %modified;
     my $numchanged = 0;
-    my ($version,$parts) = split(/:/,$env{'form.HIDE'.$newflg},2);
     if (exists($record->{$version.':keys'})) {
         my $partsregexp = $parts;
         $partsregexp =~ s/,/|/g;
@@ -5063,7 +5063,8 @@
             my $aggregateflag = 0;
             if ($env{'form.HIDE'.$prob}) {
                 my %record = &Apache::lonnet::restore($symbx,$env{'request.course.id'},$udom,$uname);
-                my $numchgs = &makehidden($prob,\%record,$symbx,$udom,$uname);
+                my ($version,$parts) = split(/:/,$env{'form.HIDE'.$prob},2);
+                my $numchgs = &makehidden($version,$parts,\%record,$symbx,$udom,$uname);
                 $hideflag += $numchgs;
             }
 	    foreach my $partid (@{$parts}) {




More information about the LON-CAPA-cvs mailing list