--- loncom/interface/loncommon.pm 2014/11/08 18:26:06 1.1199 +++ loncom/interface/loncommon.pm 2014/11/21 17:59:06 1.1200 @@ -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 @@ sub get_previous_attempt { } } elsif ($data eq 'regrader') { if (($identifier ne '') && (@parts)) { - $regraded{$parts[-1]} = 1; + my $id = join(',',@parts); + $regraded{$ign.'.'.$id} = 1; } } } else { @@ -3851,16 +3852,18 @@ sub get_previous_attempt { $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,@unsolved); if (%typeparts) { foreach my $id (keys(%typeparts)) { @@ -3871,7 +3874,7 @@ sub get_previous_attempt { 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 @@ sub search_courses { return %courses; } - =pod =back