-
-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug with LimitedFraction and MathQuill #1169
Comments
What MathQuill does with this hasn't changed from 2.19 to now. I suspect this is another issue with the contextFraction.pl changes, and using the contextExtensions.pl macro. |
I am able to fix the issue with reverting the following change to the diff --git a/macros/contexts/contextFraction.pl b/macros/contexts/contextFraction.pl
index 3179d09d..49e8e029 100644
--- a/macros/contexts/contextFraction.pl
+++ b/macros/contexts/contextFraction.pl
@@ -345,8 +345,11 @@ sub Init {
$context->{error}{msg}{"You are not allowed to type decimal numbers in this problem"} =
"You are only allowed to enter fractions, not decimal numbers";
- $context = $main::context{LimitedFraction} = context::Fraction::extending('LimitedNumeric');
+ $context = $main::context{LimitedFraction} = $context->copy;
$context->{name} = "LimitedFraction";
+ $context->operators->undefine('+', '-', '*', '* ', '^', '**', 'U', '.', '><', 'u+', '!', '_', ',',);
+ $context->parens->undefine('|', '{', '[');
+ $context->functions->disable('All');
$context->flags->set(
strictFractions => 1,
allowMixedNumbers => 1, |
Here is a change that I think will resolve the issue while still using the LimitedNumeric context. diff --git a/macros/contexts/contextFraction.pl b/macros/contexts/contextFraction.pl
index 112878a9..2aea9ee8 100644
--- a/macros/contexts/contextFraction.pl
+++ b/macros/contexts/contextFraction.pl
@@ -354,6 +354,7 @@ sub Init {
showMixedNumbers => 1,
);
$context->{cmpDefaults}{Fraction} = { studentsMustReduceFractions => 1 };
+ $context->parens->redefine('(');
$context = $main::context{LimitedProperFraction} = $context->copy;
$context->flags->set(requireProperFractions => 1);
@@ -673,7 +674,7 @@ our @ISA = ('context::Fraction::Class', 'Parser::UOP');
sub _check {
my $self = shift;
$self->{hadParens} = 1 if $self->{op}{hadParens};
- &{ $self->super('_check') }($self);
+ &{ $self->super('_check') }($self) unless $self->extensionClassMatch($self->{op}, 'FRACTION');
$self->setExtensionClass('MINUS') if $self->{op}->class eq 'Number';
$self->mutate;
} |
Thanks @dpvc, that works for the two problems I know of where this issue had bubbled up. |
With the MWE below, it behaves as expected in 2.19. But in develop, when you submit the answer
-1/2
with MathQuill, the answer ends up submitted as-(1/2)
and is not accepted.The text was updated successfully, but these errors were encountered: