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

PG debug messages are not shown in the problem editor. #2661

Open
dlglin opened this issue Jan 24, 2025 · 1 comment
Open

PG debug messages are not shown in the problem editor. #2661

dlglin opened this issue Jan 24, 2025 · 1 comment

Comments

@dlglin
Copy link
Member

dlglin commented Jan 24, 2025

The following MWE enables diagnostics for an answer checker. The diagnostics are not displayed in the problem editor, but are displayed when the problem is viewed in a homework set.

DOCUMENT();

loadMacros(
    "PGstandard.pl",    # Standard macros for PG language
    "PGML.pl",          # PGML markup and Math Objects
    "PGcourse.pl",      # Customization file for the course
);

$f = Formula("x^2");

BEGIN_PGML
[_]{$f->cmp(diagnostics=>1)}
END_PGML
ENDDOCUMENT();
@drgrice1
Copy link
Member

The debugging messages are only shown for the debug format when using the rpc endpoints. The problem editor uses the simple format. So to get debugging messages we would need to switch the problem editor to use the debug format.

Also, there is a bug in the formatRenderedProblem method that wipes out all debugging messages that come from PG for LTI grade pass back (which shouldn't even have implemented in that method).

drgrice1 added a commit to drgrice1/webwork2 that referenced this issue Jan 25, 2025
The `formatRenderedProblem` method of the `FormatRenderedProblem` module
ensures that the `debug_messages` key of the rendered problem result is
an array reference, but checks the wrong thing.  It checks if the result
itself is an array reference instead of the `debug_messages` hash key of
the result.  Since the result is always a hash reference and never an
array reference, this means that the debugging messages from PG are
always wiped out and replaced with a reference to an empty array.

This was discovered when investigating openwebwork#2661.
If we want to switch the PG problem editor to using the `debug` output
format of the `formatRenderedProblem` method we could, but in order to
get the benefit of that change we need this.
drgrice1 added a commit to drgrice1/webwork2 that referenced this issue Jan 25, 2025
The `formatRenderedProblem` method of the `FormatRenderedProblem` module
ensures that the `debug_messages` key of the rendered problem result is
an array reference, but checks the wrong thing.  It checks if the result
itself is an array reference instead of the `debug_messages` hash key of
the result.  Since the result is always a hash reference and never an
array reference, this means that the debugging messages from PG are
always wiped out and replaced with a reference to an empty array.

This was discovered when investigating openwebwork#2661.
If we want to switch the PG problem editor to using the `debug` output
format of the `formatRenderedProblem` method we could, but in order to
get the benefit of that change we need this.
drgrice1 added a commit to drgrice1/webwork2 that referenced this issue Feb 1, 2025
The `formatRenderedProblem` method of the `FormatRenderedProblem` module
ensures that the `debug_messages` key of the rendered problem result is
an array reference, but checks the wrong thing.  It checks if the result
itself is an array reference instead of the `debug_messages` hash key of
the result.  Since the result is always a hash reference and never an
array reference, this means that the debugging messages from PG are
always wiped out and replaced with a reference to an empty array.

This was discovered when investigating openwebwork#2661.
If we want to switch the PG problem editor to using the `debug` output
format of the `formatRenderedProblem` method we could, but in order to
get the benefit of that change we need this.
drgrice1 added a commit to drgrice1/webwork2 that referenced this issue Feb 4, 2025
This is as discussed in openwebwork#2661, openwebwork#2662 and the developer meeting.  The PG
problem editor is switched to the debug format from the simple format.
The only difference for the problem editor page is that if there are
debug messages they are now shown.  Usually there aren't any such
messages, and so there isn't a difference.  But if something is enabled
like the MathObject diagnostics cmp flag, then those debug messages are
shown.
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

No branches or pull requests

2 participants