Skip to content
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

Fix an issue with the graphtool default number line interval checker. #1184

Merged

Conversation

drgrice1
Copy link
Member

The checker for intervals compares the interval graphed by the student to the correct interval as MathObjects. However, the context of the graphtool is a modified Point context. This generally is fine. A half open or half closed interval or an unbounded interval is still an interval and the comparison works. However, a bounded open interval or a bounded closed interval both end up being points. As a result if the correct answer is a bounded open interval and the student graphs an interval with the same endpoints, but closed, the current checker counts that as correct.

To fix this, this sets the '[' paren to always be an interval the same as in the Interval context. The graphtool answers given by javascript will never need that to be anything else, so this works.

A minimal working example that demonstrates the issue is the following problem:

DOCUMENT();
loadMacros(qw{PGstandard.pl PGML.pl parserGraphTool.pl});

$graph = GraphTool("{interval, (1, 5)}")->with(
    availableTools => [ 'IntervalTool', 'IncludeExcludePointTool' ],
    numberLine     => 1
);

BEGIN_PGML
Graph the interval [`(1, 5)`].

[_]{$graph}
END_PGML

ENDDOCUMENT();

For the develop or main branch if you graph the closed interval from 1 to 5, it is counted correct. Of course, with this pull request it is incorrect.

Note that for all branches and this pull request the open interval from 1 to 5 is counted correct. Of course a half open (or half closed) interval from 1 to 5 and all other incorrect answers are counted incorrect.

You can also experiment with other correct answers, and they all should work with this pull request.

The checker for intervals compares the interval graphed by the student
to the correct interval as MathObjects.  However, the context of the
graphtool is a modified `Point` context.  This generally is fine.  A
half open or half closed interval or an unbounded interval is still an
interval and the comparison works.  However, a bounded open interval or
a bounded closed interval both end up being points. As a result if the
correct answer is a bounded open interval and the student graphs an
interval with the same endpoints, but closed, the current checker counts
that as correct.

To fix this, this sets the '[' paren to always be an interval the same
as in the `Interval` context.  The graphtool answers given by javascript
will never need that to be anything else, so this works.

A minimal working example that demonstrates the issue is the following
problem:

```perl
DOCUMENT();
loadMacros(qw{PGstandard.pl PGML.pl parserGraphTool.pl});

$graph = GraphTool("{interval, (1, 5)}")->with(
    availableTools => [ 'IntervalTool', 'IncludeExcludePointTool' ],
    numberLine     => 1
);

BEGIN_PGML
Graph the interval [`(1, 5)`].

[_]{$graph}
END_PGML

ENDDOCUMENT();
```

For the develop or main branch if you graph the closed interval from 1
to 5, it is counted correct. Of course, with this pull request it is
incorrect.

Note that for all branches and this pull request the open interval from
1 to 5 is counted correct.  Of course a half open (or half closed)
interval from 1 to 5 and all other incorrect answers are counted
incorrect.

You can also experiment with other correct answers, and they all should
work with this pull request.
Copy link
Member

@pstaabp pstaabp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes the issue.

@drgrice1
Copy link
Member Author

@pstaabp is back!

Copy link
Contributor

@somiaj somiaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed this fixes the issue.

@somiaj somiaj merged commit 29483af into openwebwork:develop Jan 28, 2025
3 checks passed
@drgrice1 drgrice1 deleted the bugfix/graphtool-open-interval-checker branch January 28, 2025 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants