Log Message:
-----------
Allow diagnostics to show the adapted function's values.
Modified Files:
--------------
pg/macros:
parserFormulaUpToConstant.pl
Revision Data
-------------
Index: parserFormulaUpToConstant.pl
===================================================================
RCS file: /webwork/cvs/system/pg/macros/parserFormulaUpToConstant.pl,v
retrieving revision 1.16
retrieving revision 1.17
diff -Lmacros/parserFormulaUpToConstant.pl -Lmacros/parserFormulaUpToConstant.pl -u -r1.16 -r1.17
--- macros/parserFormulaUpToConstant.pl
+++ macros/parserFormulaUpToConstant.pl
@@ -118,6 +118,7 @@
#
my $context = (Value::isContext($_[0]) ? shift : $self->context)->copy;
$context->{parser}{Variable} = 'FormulaUpToConstant::Variable';
+ $context->{diagnostics}{formulas}{showGraphs} = 0;
#
# Create a formula from the user's input.
#
@@ -176,9 +177,11 @@
#
# Compare with adaptive parameters to see if $l + n0 C = $r for some n0.
#
- $main::{_cmp_} = sub {return $l->adapt == $r}; # a closure to access local variables
+ my $adapt = $l->adapt;
+ $main::{_cmp_} = sub {return $adapt == $r}; # a closure to access local variables
my $equal = main::PG_restricted_eval('&{$main::{_cmp_}}'); # prevents errors with large adaptive parameters
delete $main::{_cmp_}; # remove temprary function
+ $self->{adapt} = $self->{adapt}->inherit($adapt); # save the adapted value's flags
return -1 unless $equal;
#
# Check that n0 is non-zero (i.e., there is a multiple of C in the student answer)
@@ -188,6 +191,15 @@
}
#
+# Provide diagnostics based on the adapted function used to check
+# the student's answer
+#
+sub cmp_diagnostics {
+ my $self = shift;
+ $self->inherit($self->{adapt})->SUPER::cmp_diagnostics(@_);
+}
+
+#
# Return the {adapt} formula with test points adjusted
#
sub adapt {
|