Add flags for context related to partial credit of SigFig problems.#34
Conversation
5fdce91 to
12e0598
Compare
|
@dpvc Now that I have more time, getting back to this. The code that I have in the PR is to add a couple of flags that allow partial credit if either the student answer matches the correct answer (within tolerance) but the number of sig figs is wrong or the number of sig figs matches and the student answer is incorrect but within tolerance. We had this working on a different branch before I merged your code about handling the exponential form. I've been testing with the units as: Now, I'm getting the following error: This looks like it's calling the new STRING method that you put in, but isn't being handled right with units. |
|
@dpvc wondering if you have some time to take a look at this? |
|
OK, I have been able to track down what is going on. The mechanism for extending a context to have new features without losing the old ones is a complicated one, and the new classes don't actually inherit from the old ones, but have to handle them carefully in order to access the older class methods. The classes that I added to the SignificantFigures context share common functions using a common package that is inherited by all of them. But when the units context extends that, it doesn't inherit the common package, and so doesn't find those methods; I think I have a fix for that, but it has to be made in the diff --git a/macros/contexts/contextExtensions.pl b/macros/contexts/contextExtensions.pl
index c9f8700d..ea0a6482 100644
--- a/macros/contexts/contextExtensions.pl
+++ b/macros/contexts/contextExtensions.pl
@@ -460,6 +460,23 @@ sub extensionContext {
return $class;
}
+#
+# Trap any calls to super-class methods that aren't in the overriden
+# class and pass them on to the original class.
+#
+sub AUTOLOAD {
+ our $AUTOLOAD;
+ my $self = shift;
+ my $class = $self->extensionContext;
+ my $method = (split(/::/, $AUTOLOAD))[-1];
+ if (substr($AUTOLOAD, 0, length($class) + 2) eq $class . '::') {
+ my $code = $self->super($method);
+ return &$code($self, @_) if $code;
+ }
+ my ($pkg, $file, $line, $subname) = caller(0);
+ die "Can't locate object method \"$method\" via package \"". ref($self) . '"' . " at line $line of $file\n";
+}
+
#################################################################################################
#################################################################################################This uses the perl I think that will do the trick for you, and should male |
|
Somehow closed this. I couldn't reopen, so a new version is at #36 |
This includes flags for determining if a problem is to check to see if an answer has the correct # of sig figs and/or is close and give partial credit.