--- loncom/homework/inputtags.pm 2002/11/19 14:59:35 1.74 +++ loncom/homework/inputtags.pm 2002/11/27 19:25:56 1.75 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # input definitons # -# $Id: inputtags.pm,v 1.74 2002/11/19 14:59:35 sakharuk Exp $ +# $Id: inputtags.pm,v 1.75 2002/11/27 19:25:56 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -47,6 +47,8 @@ sub initialize_inputtags { @Apache::inputtags::responselist=(); # list of whether or not a specific response was previously used @Apache::inputtags::previous=(); + # submission it was used in + @Apache::inputtags::previous_version=(); # id of current part, 0 means that no part is current (inside only $Apache::inputtags::part=''; # list of problem date statuses, the first element is for @@ -388,13 +390,23 @@ sub grade { my $finalaward = &finalizeawards(@awards); my $previously_used; if ( $#Apache::inputtags::previous eq $#awards ) { - $previously_used = 'PREVIOUSLY_LAST'; - foreach my $value (@Apache::inputtags::previous) { - if ($value eq 'PREVIOUSLY_USED' ) { - $previously_used = $value; - last; + my $match=0; + my @matches; + foreach my $versionar (@Apache::inputtags::previous_version) { + foreach my $version (@$versionar) { + $matches[$version]++; + } + } + foreach my $elem (@matches) {if ($elem eq ($#awards+1)) {$match=1;}} + if ($match) { + $previously_used = 'PREVIOUSLY_LAST'; + foreach my $value (@Apache::inputtags::previous) { + if ($value eq 'PREVIOUSLY_USED' ) { + $previously_used = $value; + last; + } + } } - } } &Apache::lonxml::debug("final award $finalaward, $previously_used"); &setgradedata($finalaward,$id,$previously_used);