--- loncom/interface/loncommon.pm 2014/11/08 18:26:06 1.1199 +++ loncom/interface/loncommon.pm 2014/12/01 22:52:48 1.1201 @@ -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.1201 2014/12/01 22:52:48 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 '') && @@ -4736,13 +4739,13 @@ END_BLOCK ############################################### sub check_ip_acc { - my ($acc)=@_; + my ($acc,$clientip)=@_; &Apache::lonxml::debug("acc is $acc"); if (!defined($acc) || $acc =~ /^\s*$/ || $acc =~/^\s*no\s*$/i) { return 1; } my $allowed=0; - my $ip=$env{'request.host'} || $ENV{'REMOTE_ADDR'}; + my $ip=$env{'request.host'} || $ENV{'REMOTE_ADDR'} || $clientip; my $name; foreach my $pattern (split(',',$acc)) { @@ -15323,7 +15326,6 @@ sub search_courses { return %courses; } - =pod =back