--- loncom/homework/response.pm 2007/04/07 00:42:29 1.161 +++ loncom/homework/response.pm 2007/04/17 23:25:09 1.162 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # various response type definitons response definition # -# $Id: response.pm,v 1.161 2007/04/07 00:42:29 albertel Exp $ +# $Id: response.pm,v 1.162 2007/04/17 23:25:09 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1095,6 +1095,33 @@ sub check_status { return 2; } +sub setup_prior_tries_hash { + my ($func,$data) = @_; + my $part = $Apache::inputtags::part; + my $id = $Apache::inputtags::response[-1]; + foreach my $i (1..$Apache::lonhomework::history{'version'}) { + my $sub_key = "$i:resource.$part.$id.submission"; + next if (!exists($Apache::lonhomework::history{$sub_key})); + my @other_data; + foreach my $datum (@{ $data }) { + if (ref($datum)) { + push(@other_data,$datum); + } else { + my $info_key = "$i:resource.$part.$id.$datum"; + push(@other_data,$Apache::lonhomework::history{$info_key}); + } + } + + my $output = + &$func('grade', + $Apache::lonhomework::history{$sub_key}, + \@other_data); + if (defined($output)) { + $Apache::inputtags::submission_display{$sub_key} = $output; + } + } +} + 1; __END__