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 sub createRandomPoints so that when test_at points are included, … #474

Merged

Conversation

taniwallach
Copy link
Member

Fix sub createRandomPoints so that when test_at points are included it still generates num_points random points in addition to the provided points, as intended. This fixes the issue reported in #472 so that the test_at works as documented in https://webwork.maa.org/wiki/Context_flags .

…it still generates num_points random points in addition to the provided points, as intended. See: https://webwork.maa.org/wiki/Context_flags
@taniwallach taniwallach requested a review from dpvc May 18, 2020 17:34
Copy link
Member

@dpvc dpvc left a comment

Choose a reason for hiding this comment

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

Looks good.

@taniwallach
Copy link
Member Author

The easiest way to see how this changes the behavior is to set diagnostics=>1 inside a cmp() call where the relevant MathObject Formula has test_at set. Then during grading a table about the test points and what occurred at each is shown.

A sample PG file which sets 8 test_at points and has that flag set is below.

Before the patch, when graded - that problem would only test at the 8 given points.
After the patch - those 8 points and 5 random points are tested.


DOCUMENT();

loadMacros(
  "PGstandard.pl",
  "MathObjects.pl",
);

Context("Numeric");
Context()->variables->are(r =>'Real', t =>'Real',p =>'Real');

$int  = Compute("(r^2)*sin(p)*cos(t)");

$int->{test_at} = [ [ 1, 1, 1],
                 [ 1, 1,-1],
                 [ 1,-1, 1],
                 [ 1,-1,-1],
                 [-1, 1, 1],
                 [-1, 1,-1],
                 [-1,-1, 1],
                 [-1,-1,-1],
               ];

#################################################################################

Context()->texStrings;
BEGIN_TEXT
Enter \( $int \) below:

$BCENTER
\{ $int->ans_rule(20)\}
$ECENTER

END_TEXT
Context()->normalStrings;

ANS( $int->cmp( diagnostics=>1 ) );

ENDDOCUMENT();

@taniwallach taniwallach requested a review from drgrice1 May 18, 2020 18:42
@taniwallach
Copy link
Member Author

@drgrice1 Do you mind doing a quick test and merging?

Copy link
Member

@drgrice1 drgrice1 left a comment

Choose a reason for hiding this comment

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

I can verify that this works as stated. Without the pull request the diagnostics shows only 8 test points were used. With the pull request 5 other random test points are also used.

Looks good.

@drgrice1 drgrice1 merged commit d5733cc into openwebwork:develop May 18, 2020
@taniwallach taniwallach deleted the fix_num_points_for_use_with_test_at branch May 18, 2020 19:11
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