--- loncom/homework/inputtags.pm 2002/11/08 20:34:10 1.73 +++ 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.73 2002/11/08 20:34:10 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 @@ -169,6 +171,8 @@ sub start_textline { } elsif ($target eq 'modified') { my $constructtag=&Apache::edit::get_new_args($token,$parstack,$safeeval,'size'); if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); } + } elsif ($target eq 'tex') { + $result='\framebox[1cm][s]{\hfill}'; } return $result; } @@ -386,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);